
I am personally using Nginx as my primary web server with PHP-FPM but also having some setups with Nginx as a proxy to Apache Server. Many times, when I try to upload a file or made a large HTTP request, Nginx gives the error 413 request entity too large. That’s why I thought this issue needs to be documented.
Error 413 request entity too large occurs when a client request exceeds the maximum accepted body size by the webserver configuration. The two most used webservers are Apache and Nginx.
The default request size allowed by Apache is unlimited but in Nginx, it is only 1 MB. That’s why when we try to upload a file larger than 1 MB, Nginx giving the request entity too large error. In this article, you will find how to control HTTP request size in Apache and Nginx.
Fixing request entity too large error in Nginx
In Nginx, the maximum client request body size is defined by the client_max_body_size directive. By default, it is defined in the Nginx configuration file located in /etc/nginx/nginx.conf. However, you can directly define it into either your http, location or server block.