繁体   English   中英

连接重置 - 使用 nginx 和 php-fpm7.2 从上游读取响应头时

[英]Connection reset by peer - while reading response header from upstream using nginx and php-fpm7.2

下面是错误日志:

nginx

[错误] 6518#6518:*1548 recv() 在从上游读取响应头时失败(104:连接重置),客户端:106.51.134.160,服务器:example.com,请求:“POST /api/example HTTP/ 1.1”,上游:“fastcgi://unix:/run/php/php7.2-fpm.sock:”,主机:“example.com”

php7.2-fpm.log

[错误] 6518#6518:*1548 recv() 在从上游读取响应头时失败(104:连接重置),客户端:106.51.134.160,服务器:api.onsurity.com,请求:“POST /api/example HTTP/1.1”,上游:“fastcgi://unix:/run/php/php7.2-fpm.sock:”,主机:“example.com”

我增加了 nginx.conf 中的超时和大小

client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 200M;
sendfile on;
send_timeout 300s;
fastcgi_read_timeout 600s;

另一个解决方案提到增加 php.ini 中的请求超时和其他限制

upload_max_filesize=2000M
max_file_uploads=2000
memory_limit=128M
post_max_size=8000M
request_terminate_timeout = 300s

它在点击包含 base64 图像数组的发布请求时显示 502 网关错误。 大约大小为 6MB

如果您已经在 Nginx 和 PHP-FPM 中完成了所有建议的配置并且您托管在 AWS 中,请尝试增加弹性负载均衡器的空闲超时(通常默认为 60 秒)。

空闲超时

更多信息请访问: https : //aws.amazon.com/blogs/aws/elb-idle-timeout-control/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM