If you’re getting the obnoxious “client intended to send too large body” error like I am, you’re in luck because today we’re going to solve the article. In fact, I’m writing this paragraph before I’ve even solved the error in anticipation that I will solve it and have an article to post.

What’s actually happening is that I just built this site on a new server, and I was trying to upload a large image for an article that I’m writing. The image is only 1.5mb but on the web that’s very large, so nginx is probably blocking it. Usually you can just upload a smaller image and it’ll be fine, but why let the error keep us down?

Most likely the problem is a bad configuration somewhere. And… sure enough.

Fixing the Error

You’re going to need to go find your nginx configuration files. On my server they are located under /usr/local/nginx/conf/ and there is a sites-enabled folder that has the actual site file. You can either add this option under nginx.conf or the specific site config file found in the sites-enabled folder. What you’re looking for is a section that looks kinda like this:

server {
        listen  80;

Once you find that, you know you’re in the right place. Underneath that, you’re going to want to add this line, which will set the max body size for an incoming client request to 5 MB. You can change it to 10MB or 100MB or any other value that you’d prefer, but 5MB was a good value for our purposes.

client_max_body_size 5M;

Of course, you should consider carefully whether allowing larger requests is something you want to do, because it can be a security issue to allow huge requests to come in, especially if you get hit by a DDoS or just a misconfigured client script.

Profile Photo for Lowell Heddings Lowell Heddings
Lowell is the founder and CEO of How-To Geek. He’s been running the show since creating the site back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work.
Read Full Bio »