nginx服务器upstream timed out (110: Connection timed out)以及recv() failed (104: Connection reset by peer)解决方法

  1. upstream timed out (110: Connection timed out) while reading response header from upstream
修改 nginx.conf 或者自定义的 如 vhost/blog.windigniter.com.conf
        location / {
            root   /data/www/blog.windigniter.com;
            index  index.php index.html index.htm;
            if (!-e $request_filename){
                rewrite ^(.+)$ /index.php last;
            }
            proxy_read_timeout 150;
        }
        
        location ~ \.php$ {
            root           /data/www/blog.windigniter.com;
            fastcgi_read_timeout 150;
            fastcgi_pass   windigniter;
            fastcgi_index  index.php;
            include        fastcgi_params;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  SCRIPT_NAME  $fastcgi_script_name;
        }
fastcgi_pass windigniter; 的配置是根据自己定义的 upstream来决定的,如下面2所示 2. recv() failed (104: Connection reset by peer) while reading response header from upstream 修改 nginx.conf
    upstream windigniter {
        server 127.0.0.1:9000 weight=1 max_fails=60 fail_timeout=30;
    }
经过以上 添加 添加粗体部分的内容就可以解决,110 Connection time out 和 104 Connection reset by peer 的问题了,上次在公司处理2的时候虽然已经重启了,但还是过了几分钟才生效,未查明原因。