Solution to the problem of 413 Request Entity Too Large in nginx

WBOY
Release: 2016-08-08 09:24:47
Original
1674 people have browsed it

nginx The solution to the 413 Request Entity Too Large problem

Use php to upload images (size 1.9M), and the nginx: 413 Request Entity Too Large error appears.

According to experience, the server limits the size of uploaded files, but the default file upload in PHP is 2M, so there should be no problem.

Open php.ini, change upload_max_filesize and post_max_size to 20M, and then restart.

Uploaded again, the problem remains, the problem with php can be eliminated.

It turns out that the default upload file size of nginx is 1M, which can be modified in nginx settings.

The solution is as follows:

1. Open the nginx configuration file nginx.conf, the path is generally: /etc/nginx/nginx.conf.

2. Add client_max_body_size 20m in the http{} section; 20m is the maximum allowed upload size.

3. Restart nginx after saving and the problem is solved.

The above introduces the solution to the 413 Request Entity Too Large problem 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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!