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:
# set client body size to 2M #
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: