php – nginx错误“recv()失败(104:对等连接重置)从上游读取响应头”

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了php – nginx错误“recv()失败(104:对等连接重置)从上游读取响应头”脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一台服务器工作正常,直到2013年10月3日上午10:50,它开始间歇性地向客户端返回“502 Bad Gateway”错误.

大约有五分之四的浏览器请求成功,但大约五分之一的用户失败了502.

Nginx错误日志包含数百个这样的错误;

2013/10/05 06:28:17 [error] 3111#0: *54528 recv() Failed (104: Connection reset by PEer) while reading response header From upstream,client: 66.249.66.75,server: www.bec-components.co.uk  request: ""GET /?_n=Fridgefreezer/Hotpoint/8591p;_i=x8078 HTTP/1.1",upstream: "fastcgi://127.0.0.1:9000",host: "www.bec-components.co.uk"

但是PHP错误日志不包含任何匹配错误.

有没有办法让PHP给我更多关于它为什么重置连接的信息?

这是Nginx.conf;

user              www-data;
worker_PRocesses  4;
error_LOG         /VAR/log/Nginx/error.log;
pid               /var/run/Nginx.pid;

events {
   worker_connections  1024;
}

http {
  include          /etc/Nginx/mime.types;
  access_log       /var/log/Nginx/access.log;

  sendfile               on;
  keepalive_timeout      30;
  tcp_nodelay            on;
  client_max_body_size   100m;

  gzip         on;
  gzip_types   text/plain application/XMl text/javascript application/x-javascript text/css;
  gzip_disable "MSIE [1-6]\.(?!.*SV1)";

  include /gvol/sITes/*/Nginx.conf;

}

这是该网站的.conf;

server {

  server_name   www.bec-components.co.uk bec3.uk.to bec4.uk.to bec.home;
  root          /gvol/sites/bec/www/;
  index         index.PHP index.htML;

  location ~ \.(js|css|png|jpg|jpeg|gif|ico)${
    expires        2592000;   # 30 days
    log_not_found  off;
  }

  ## Trigger client to download instead of display '.xml' files.
  location ~ \.xml${
    add_header Content-disposition "attachment; filename=$1";
  }

   location ~ \.PHP${
      fastcgi_read_timeout  3600;
      include               /etc/Nginx/fastcgi_params;
      keepalive_timeout     0;
      fastcgi_param         SCRIPT_FILENAME  $document_root$fastcgi_SCRIPT_NAME;
      fastcgi_pass          127.0.0.1:9000;
      fastcgi_index         index.PHP;
   }
}

## bec-components.co.uk ##
server {
   server_name   bec-components.co.uk;
   rewrite       ^/(.*) http://www.bec-components.co.uk$1 permanent;
}
如果我的网络服务器告诉我,我总是相信:502 Bad Gateway

>你的fastcgi / Nginx进程的正常运行时间是多少?
>你监控网络连接
>你能否确认/否认当天的访客数量变化?

是什么意思

> Nginx无法访问fastcgi-process;要么减慢要么根本不对应.坏网关意味着:Nginx不能fastcgi_pass到那个定义的资127.0.0.1:9000;在那个非常具体的时刻.
>您的初始错误日志告诉所有:

.

recv() Failed 
    -> Nginx Failed

(104: Connection reset by peer) while reading response header from upstream,-> no complete answer,or no answer at all
upstream: "fastcgi://127.0.0.1:9000",-> who is he,who Failed???

我有限的pov我建议:

>重启你的fastcgi_process / server>检查您的访问日志>启用debug-log

脚本宝典总结

以上是脚本宝典为你收集整理的php – nginx错误“recv()失败(104:对等连接重置)从上游读取响应头”全部内容,希望文章能够帮你解决php – nginx错误“recv()失败(104:对等连接重置)从上游读取响应头”所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。