php5-fpm nginx google bot =连接由同行重置

前端之家收集整理的这篇文章主要介绍了php5-fpm nginx google bot =连接由同行重置前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

所以我只是花了一个小时试图弄清楚为什么我的日志在最后几个小时内每分钟都有几次缓慢的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,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,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,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,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,request: "GET /c.html?q= xyz HTTP/1.1",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,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,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,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,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,host: "www.domain.com"

对等体重置连接的原因是什么.谷歌机器人真的会访问页面并终止请求,只是检查它是否还活着?

这不是很好,因为它调用我的curl请求,然后属于孤立线程,因为客户端已退出.意思是他们只是超时造成缓慢的PHP脚本.

或者我读错了吗?

最佳答案
如果您查看错误消息,它会说

while reading response header from upstream

这意味着问题不是谷歌正在终止请求,而是Nginx的上游,恰好是PHP-fpm,正在终止请求.通常,这是由运行PHP代码错误引起的.

鉴于我们没有代码,以下是一些常规故障排除步骤:

>在PHP-fpm的配置中,增加request_terminate_timeout,max_input_time和max_execution_time的值.
>激活PHP.ini或pool .conf配置文件中的错误记录(但不是“display_error”,如果它是生产网站).
>尝试在运行的代码上运行调试器(xdebug非常有用)来逐步执行代码,您将遇到大多数问题.

原文链接:https://www.f2er.com/nginx/434419.html

猜你在找的Nginx相关文章