In this tutorial we will show you how to Fix Nginx 413 Request Entity Too Large on Linux server. For those of you who didn’t know, Nginx is a powerful web server software that can be used on your server. It is also known for its high performance and low memory usage which will allow fewer resources to be used but getting the job done efficiently. A popular set up is to use it as a proxy for Apache, which can then serve application requests.
I’m running an Nginx powered server I have configured a while ago. One problem I have on my WordPress sites hosted on that environment is that I couldn’t upload file 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 the client request. If the 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 webserver to apply the changes.
Step 3. Edit PHP configuration (optional).
Your PHP installation also puts limits on upload file size. Edit php.ini and set the following directives:
Congratulations! You have successfully Fix Nginx 413. Thanks for using this tutorial for Fix Nginx 413 on your Linux system. For additional help or useful information, we recommend you to check the official Nginx website.