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

Nginx 413 Request Entity Too Large error solution

WBOY
Release: 2016-08-08 09:32:52
Original
3406 people have browsed it
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;
Copy after login

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

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
Copy after login

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

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.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template