Fix error: 413 Request Entity Too Large

I am running Nginx configured with FastCGI and this is the error I get.

413 Request Entity Too Large

And here’s how to fix the issue.

Edit file /etc/nginx/nginx.conf and add the following line to http or server or location context to increase the size limit.

# Fix error: 413 Request Entity Too Large
client_max_body_size 8M;

Save the file and reload nginx:

service nginx reload

I also recommend edit the PHP configuration file, because PHP installation also put limits on upload file size.

Edit file /etc/php.ini and set the following directives:

upload_max_filesize = 8M
post_max_size = 8M

Save the file and restart phpfcgi:

service phpfcgi restart