第一句子网 - 唯美句子、句子迷、好句子大全
第一句子网 > tomcat的php文件上传大小限制 PHP上传文件大小限制的调整 Nginx 413 Request Entity Too Large...

tomcat的php文件上传大小限制 PHP上传文件大小限制的调整 Nginx 413 Request Entity Too Large...

时间:2023-01-17 01:37:20

相关推荐

tomcat的php文件上传大小限制 PHP上传文件大小限制的调整 Nginx 413 Request Entity Too Large...

Nginx+php-fpm架构,遇到这个错误时:Request Entity Too Large 或 Nginx 413 Request Entity Too Large,需要做如下调整即可。

1、修改配置一:Tune Nignx.conf setting:

# set client body size to 2M under http scope

client_max_body_size 2M;

超时设置:

send_timeout 60;

fastcgi_connect_timeout 300;

fastcgi_send_timeout 300;

fastcgi_read_timeout 300;

2、修改配置二:Tune php.ini settings:

;This sets the maximum amount of memory in bytes that a script is allowed to allocate

memory_limit = 32M

;The maximum size of an uploaded file.

upload_max_filesize = 2M

;Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize

post_max_size = 3M

3、修改配置三:优化php-fpm配置

php_admin_value[memory_limit] = 1224M

3/28 UPDATE:假设上传1M的文件,如果代码中有对文件进行操作的,如写入,移动等,都php-fpm至少要再分配3倍的空间,如3M。如果是上传10M的文件,则要30M php-fpm内存。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。