Tag Archives: upload

WordPress + Nginx + Uploads = 413 Request Entity Too Large

Happy WordPress Wednesday! The day of the week dedicated to talking about WordPress.

Or sad, if you had to deal with the problem I ran into today while working on our WordPress blog. I wanted to upload some larger pictures and got a cryptic 'HTTP Error'.

Let me explain the architecture I am running here so that this makes sense. I run Nginx as a reverse proxy and caching server in front of Apache. Nginx forwards traffic to apache when it needs to and serves everything from memory when it doesn't (which is incredibly fast).

Back onto the problem, the error message isn't helpful. I did what I normally do, look at the error log. I didn't see anything in the apache log or the nginx log.

What I did discover was by opening Chrome's developer tools and watching the Network tab I could see the file uploads were failing. They were red and had a status code of 413: Request Entity too Large.

Now I know my httpd.conf (Apache's config file) was set to accept files as big as these images.

So now I had to look at the nginx.conf. What I discovered was nginx's default setting is 1 megabyte. So I added this line to my http configuration within nginx:

client_max_body_size 20m;

According to the documentation you can put it in http, server, and location.

A quick

service nginx restart

And all was well in the world.