How to fix Nginx Error "413 Request Entity Too Large" ?

How to fix Nginx Error "413 Request Entity Too Large" ?

Nginx Error 413 Request Entity Too Large :

This error is a very common error in nginx, which normally comes when we requests more information than is limited by PHP and Nginx configurations. It occurs on stand alone nginx server, when nginx acts as a front end server for apache at back end server.

How can we Fix it?

You can fix it by increasing the memory limit in nginx and php configuration file (php.ini).

1). To increase memory limit in NGINX Configuration File:

To modify NGINX Configuration File edit nginx.conf file.
-----
# vim /etc/nginx/nginx.conf
-----

Kindly find the variable "client_max_body_size" and increase its size, If it is not there in file, then you can add it inside http block.

Restart nginx to apply the changes:
-----
# sudo service nginx restart
-----

2). Now increase limits in PHP.ini File:

You can edit php.ini file through :
-----
# vim /etc/php.ini
-----
Edit the limits according to your needs for these variables:
-----
upload_max_filesize
post_max_size

-----

Then save it and restart PHP.
-----
# sudo service apache restart
-----
Author
bhawanisingh
Views
2,471
First release
Last update
Rating
0.00 star(s) 0 ratings
Top