How To Fix Nginx 413 Request Entity Too Large

Fix Nginx 413 Request Entity Too Large

I’m running a Nginx powered server I have configured a while ago. One problem I have on my wordprees sites hosted on that environment is that I couldn’t upload a files larger than 2MB. I got Nginx: 413 Request Entity Too Large error. After investigating I found the client_max_body_size directive determines the maximum accepted body size of client request. If size is greater than the given one, that’s when we get the error “Request Entity Too Large” (413).

If you’re getting 413 Request Entity Too Large errors trying to upload files to your webserver, you need to increase the client body size limit in your nginx.conf configuration file.

Fix Nginx 413 Request Entity Too Large

Step 1. First edit nginx.conf.

Add client_max_body_size in http section:

Step 2. Restart Nginx web server to apply the changes.

Step 3. Edit PHP configuration (optional).

Your php installation also put limits on upload file size. Edit php.ini and set the following directives:

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get a best deal!