Request Enity Too Large

LNMP (php) architecture

When uploading the file, an error occurred:

Error 1: 413 Request Enity Too Large (error caused by nginx limitation)

Error 2: php.ini (error caused by restricted php)

Transmission schematic diagram:
Insert picture description here

Error 1 adjustment method:

Modify the nginx configuration file: nginx.conf or conf.d/xxx.conf
client_max_body_size 100m;

Context:	http, server, location

At this time, after adjusting nginx, you also need to adjust php, because the default size of php is 2M

Error 2 adjustment method:

vim /etc/php.ini

In php, the default maximum execution time of the page is 30 seconds. That is, the script will stop executing if it exceeds 30 seconds. The default is 30 seconds.
Changing to 0 means no limit max_execution_time = 0

The default post_max_size of php is 2M. If the POST data size is larger than post_max_size $_POST and $_FILES superglobals will be empty.
post_max_size = 150M

At this time, the maximum upload file size is still 8M. There is also a parameter upload_max_filesize that indicates the maximum size of the uploaded file.
upload_max_filesize = 100M

Another thing to note is that post_max_size greater than upload_max_filesize is the best.

Guess you like

Origin blog.csdn.net/weixin_45320660/article/details/108210062