HTTP 413 Request Entity Too Large

I finally found some time over the long weekend to set up a new photo blog. I plan to write a few longer posts about nginx/php-fpm and WordPress later, but this one should be quick and easy. I had WordPress up and running, and I was uploading photos with no problems for the most part. A few images were failing to upload with a very generic HTTP Error (as reported by WordPress). It was always the same images, and they would always fail. I had already bumped post_max_size and upload_max_filesize in php.ini, so file size shouldn’t have been an issue, but the failing images did appear to be a little larger than the others. So I opened up the network tab of Chrome’s Developer Tools and found a more specific error:

HTTP 413 Request Entity Too Large

A quick Google revealed this helpful post — nginx has a maximum client body size limit. Adding client_max_body_size 8M; to the server { ... } section of my nginx configuration fixed the problem. I chose 8M somewhat arbitrarily, you should use whatever setting you have for post_max_size in your php.ini.

Tagged , , ,

Leave a Reply

Your email address will not be published. Required fields are marked *