Home  >  Article  >  Backend Development  >  Nginx 413 Request Entity Too Large error solution

Nginx 413 Request Entity Too Large error solution

WBOY
WBOYOriginal
2016-08-08 09:32:523369browse
413 Request Entity Too Large error occurs in Nginx. This error usually occurs when uploading files. Open the nginx main configuration file nginx.conf, find the http{} section, and add

The solution is

Open nginx main configuration file nginx.conf, usually at /usr/local/nginx/conf/nginx.conf, find the http{} section, modify or add

client_max_body_size 2m;

Then restart nginx,
sudo /etc/init.d/nginxd reload

That’s it.
If running in php, the size client_max_body_size should be similar to or slightly larger than the maximum value of the following value in php.ini, so that errors will not occur due to inconsistent submitted data sizes.
post_max_size = 2M
upload_max_filesize = 2M

Restart NGINX
kill -HUP `cat /usr/local/nginx/nginx.pid `

In order to prevent timeouts when uploading large files, you need to increase the value of max_execution_time appropriately.

The above introduces the solution to the 413 Request Entity Too Large error in Nginx, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn