Excellent software and practical tutorials
nginx Solution to the 413 Request Entity Too Large problem
When uploading a picture (size 1.9M) using PHP, an nginx: 413 Request Entity Too Large error occurs.
According to experience,serverThe size of uploaded files is limited, 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 restart.
Upload again, the problem still exists, so the problem with PHP can be ruled out.
The default upload file size of nginx is 1M, which can be modified in the nginx settings.
The solution is as follows:
1. Opennginx configuration file nginx.conf, the path is generally: /etc/nginx/nginx.conf.
2. Add in the http{} section:
client_max_body_size 20m;
The maximum upload size allowed is 20m.
3. Save and restart nginx to solve the problem.