我的 apache 错误日志文件中有此类错误消息:
[Wed Sep 27 18:45:34.289807 2017] [:error] [pid 17543] [client 66.249.79.21:47149] PHP Notice: Undefined variable: catNameUrl in /var/www/dev/page/page_display.inc.php on line 73
[Wed Sep 27 18:59:11.964934 2017] [:error] [pid 18906] [client 66.249.79.19:58443] PHP Warning: getimagesize(../include/images/sizes/3GHI9W6AyEI5/--1000.jpg): failed to open stream: No such file or directory in /var/www/dev/page/index_framed.php on line 66
每小时 1000 次:
[Wed Sep 27 18:59:11.973506 2017] [:error] [pid 18906] [client 66.249.79.19:58443] PHP Warning: Division by zero in /var/www/dev/include/php/global_images.inc.php on line 335
[Wed Sep 27 18:59:11.973729 2017] [:error] [pid 18906] [client 66.249.79.19:58443] PHP Warning: Division by zero in /var/www/dev/include/php/global_images.inc.php on line 335
[Wed Sep 27 18:59:11.973878 2017] [:error] [pid 18906] [client 66.249.79.19:58443] PHP Warning: Division by zero in /var/www/dev/include/php/global_images.inc.php on line 335
[Wed Sep 27 18:59:11.974017 2017] [:error] [pid 18906] [client 66.249.79.19:58443] PHP Warning: Division by zero in /var/www/dev/include/php/global_images.inc.php on line 335
ETC...
事实是,请求的页面没有 referer。这是正常的错误日志:
[Wed Sep 27 09:09:39.877580 2017] [:error] [pid 29730] [client XX.XX.XX.XX:18888] PHP Notice: Undefined index: cat in /var/www/dev/page/page_display.inc.php on line 441, referer: https://dev.mywebsite.com/page/redaction/p/10
https://www.abuseipdb.com/check/66.249.79.17 -> Google 搜索引擎蜘蛛
我认为,它打开了错误的 URL,然后无法打开用于动态创建图像的文件。
为什么这个 IP 访问我的开发网站时日志中没有 referer?
答案1
为什么此 IP 到达我的开发网站时日志中没有 referer?
机器人(包括 Googlebot)通常不会发送 referer 标头。
另一个考虑因素是,如果直接访问页面,则无需发送 referer 标头(在这种情况下,referer 标头通常为空白,除非编程为不空白)。
更一般地,你可能会对此感兴趣网站管理员问题,其中列出了未发送 referer 标头的其他原因(尽管上面列出的两个原因最有可能适用)。
答案2
这很可能是 Google 爬虫试图索引您的网站内容。所以我不担心。话虽如此,您还是说了这样的话:
每小时 1000 次……
并提供以下几行作为示例:
[Wed Sep 27 18:59:11.973506 2017] [:error] [pid 18906] [client 66.249.79.19:58443] PHP Warning: Division by zero in /var/www/dev/include/php/global_images.inc.php on line 335
[Wed Sep 27 18:59:11.973729 2017] [:error] [pid 18906] [client 66.249.79.19:58443] PHP Warning: Division by zero in /var/www/dev/include/php/global_images.inc.php on line 335
[Wed Sep 27 18:59:11.973878 2017] [:error] [pid 18906] [client 66.249.79.19:58443] PHP Warning: Division by zero in /var/www/dev/include/php/global_images.inc.php on line 335
[Wed Sep 27 18:59:11.974017 2017] [:error] [pid 18906] [client 66.249.79.19:58443] PHP Warning: Division by zero in /var/www/dev/include/php/global_images.inc.php on line 335
关键部分是“PHP 警告:除以零…”,因为这是网站代码和脚本中的错误。您可以选择在生产服务器上禁用 PHP 警告,这样可以消除这些错误消息,或者 — 我首选的解决方案 — 打开global_images.inc.php
,转到第 335 行,找出导致除以零错误的原因并对其进行修补。
不管你怎么说,你永远无法完全控制机器人抓取你网站的方式。但如果你想限制错误日志中的噪音,这完全在你的控制范围内。清理代码或限制网站上的“警告”级别错误,不要为此失眠。