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:
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.
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.