Nginx: 413 Request Entity Too Large Error and Solution

When you run Nginx as a front end to PHP based Apache & mod_fastcgi server, you may receive the following error while uploading images/files using your form:

Nginx 413 Request Entity Too Large

You are receiving this error because of client_max_body_size option in your Nginx configuration. If you are trying to upload an image/file which has large size then the value specified for client_max_body_size option in your Nginx configuration, you receive the above error.

How to resolve this?

You can fix the above error by modifying your Nginx configuration file. Open nginx.conf file in your editor via SSH:

# vi /usr/local/nginx/conf/nginx.conf

Search for client_max_body_size option and edit the size as per your requirement:

client_max_body_size 8M;

Save the file and close it. Make sure you do not forget to reload your Nginx server. Run the following command to reload it:

# /usr/local/nginx/sbin/nginx -s reload

Leave a Reply