How To Fix Nginx 413 Request Entity Too Large

Fix Nginx 413 Request Entity Too Large

In this tutorial, we will show you how to Fix Nginx 413 Request Entity Too Large on a 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 while getting the job done efficiently. A popular setup is to use it as a proxy for Apache, which can then serve application requests.

“413 Request Entity Too Large” is an error message that is returned by a server when it receives a request from a client that is too large. This error message is generated when the client tries to upload a file that exceeds the maximum allowed size. The error message is typically generated by the server to prevent a client from uploading very large files that might cause the server to run out of resources.


  • A server running one of the following operating systems: Ubuntu and any other Debian-based or CentOS or RHEL-based.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Fix Nginx 413 Request Entity Too Large

Step 1. Increasing the Client_Max_Body_Size.

The main Nginx configuration file is called nginx.conf, and this is where you can specify the settings for Nginx. You can also create separate configuration files for each virtual host.

nano /etc/nginx/nginx.conf

Add the following lines to the HTTP section:

# set client body size to 20M #

http {
    client_max_body_size 20M;

Save and close the file, then restart the Nginx web server to apply the changes:

sudo systemctl restart nginx

In the above example, we have increased the client_max_body_size setting to 20 MB. You can set this value to any value that you require.

For additional resources on installing Nginx, read the post below:

Step 3. Edit PHP Configuration (optional).

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

nano /etc/php.ini

;This sets the maximum amount of memory in bytes that a script is allowed to allocate
memory_limit = 32M
;The maximum size of an uploaded file.
upload_max_filesize = 20M
;Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize
post_max_size = 30M

Congratulations! You have successfully Fixed Nginx 413. Thanks for using this tutorial for Fix Nginx 413 on your Linux system. For additional help or useful information, we recommend you check the official Nginx website.

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 the best deal!



r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button