所以我只是花了一个小时试图弄清楚为什么我的日志在过去的几个小时内每分钟都有几次缓慢的PHP脚本警告。
我最初专注于php慢日志和php错误日志吓坏了认为这是我的代码。事实上,我正在实施一些DNS调整,这就是为什么我被引导到了错误的道路上。
我最终检查了nginx错误日志,它显示了来自几乎相同IP的同行连接重置的一行一行。
我用谷歌搜索了IP,发现它属于谷歌,所以这显然是谷歌机器人/蜘蛛访问该网站。
以下是错误日志的剪辑
2013/06/06 14:04:05 [error] 12313#0: *7435269 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 209.85.238.187, server: www.domain.com, request: "GET /c.html?q=xyz HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com"
2013/06/06 14:04:05 [error] 12308#0: *7435135 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 209.85.238.167, server: www.domain.com, request: "GET /c.html?q=xyz HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com"
2013/06/06 14:04:05 [error] 12308#0: *7435994 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 209.85.238.199, server: www.domain.com, request: "GET /c.html?q=xyz HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com"
2013/06/06 14:04:12 [error] 12309#0: *7436209 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 209.85.238.168, server: www.domain.com, request: "GET /c.html?q=xyz HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com"
2013/06/06 14:05:12 [error] 12309#0: *7441608 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 209.85.238.177, server: www.domain.com, request: "GET /c.html?q=xyz HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com"
2013/06/06 14:05:15 [error] 12310#0: *7440634 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 209.85.238.219, server: www.domain.com, request: "GET /c.html?q= xyz HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com"
2013/06/06 14:05:15 [error] 12313#0: *7441634 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 209.85.238.194, server: www.domain.com, request: "GET /c.html?q=xyz HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com"
2013/06/06 14:06:02 [error] 12310#0: *7444721 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 209.85.238.221, server: www.domain.com, request: "GET /c.html?q=xyz HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com"
2013/06/06 14:06:05 [error] 12308#0: *7443911 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 209.85.238.203, server: www.domain.com, request: "GET /c.html?q=xyz HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com"
2013/06/06 14:06:05 [error] 12309#0: *7445423 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 209.85.238.164, server: www.domain.com, request: "GET /c.html?q=xyz HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com"
2013/06/06 14:06:05 [error] 12310#0: *7445640 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 209.85.238.222, server: www.domain.com, request: "GET /c.html?q=xyz HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.domain.com"
对等体重置连接的原因是什么。谷歌机器人真的会访问页面并终止请求,只是检查它是否还活着?
这不是很好,因为它调用我的curl请求,然后属于孤立线程,因为客户端已退出。意思是他们只是超时造成缓慢的PHP脚本。
或者我读错了吗?
答案 0 :(得分:0)
如果您查看错误消息,则说明
从上游读取响应头
这意味着问题不是谷歌正在终止请求,而是nginx的上游(恰好是php-fpm)正在终止请求。通常,这是由运行php代码的错误引起的。
鉴于我们没有代码,以下是一些常规故障排除步骤:
request_terminate_timeout
,max_input_time
和max_execution_time
的值。