【问题标题】:Connection reset by peer - while reading response header from upstream using nginx and php-fpm7.2对等方重置连接-同时使用 nginx 和 php-fpm7.2 从上游读取响应标头
【发布时间】:2020-01-03 12:42:50
【问题描述】:

以下是错误日志:

nginx

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

php7.2-fpm.log

[error] 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

【问题讨论】:

    标签: php nginx amazon-ec2


    【解决方案1】:

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

    更多信息在这里:https://aws.amazon.com/blogs/aws/elb-idle-timeout-control/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-04
      • 2018-02-21
      • 2017-04-01
      • 2022-11-04
      • 2019-05-04
      • 2018-03-12
      • 1970-01-01
      相关资源
      最近更新 更多