【发布时间】:2017-09-23 03:36:16
【问题描述】:
这个问题已经被问过几次了,但是在查看了所有相关的帖子之后,我仍然找不到解决方案。 我正在运行 VPS(在 Ubuntu 14.04 上)并使用以下 Apache 指令来阻止垃圾邮件机器人:
RewriteEngine On
RewriteOptions inherit
RewriteCond %{HTTP_USER_AGENT} (Yandex|GozaikBot|EveryoneSocialBot) [NC,OR]
RewriteCond %{HTTP_USER_AGENT} (MJ12bot|Ezooms|Ahrefs|AndersPinkBot) [NC]
RewriteRule ^(.*)$ - [F,L]
当我使用与任何这些机器人名称匹配的用户代理模拟 HTTP 请求时,如预期的那样,我看到“禁止”和“您无权访问此服务器上的 /index.php”,但我也看到“ 此外,在尝试使用 ErrorDocument 处理请求时遇到了 500 Internal Server Error 错误。”,最重要的是,在错误日志中,我看到如下记录: "...AH00124:由于可能的配置错误,请求超出了 10 次内部重定向的限制。如有必要,请使用 'LimitInternalRecursion' 增加限制。使用 'LogLevel debug' 获取回溯。”
我的重写规则实际上有超过 60 个被阻止的机器人,我只是在这里缩短了它们以节省空间。我每天都会从这些机器人获得数千次点击,因此我的错误日志中充斥着这些 AH00124 错误...
对我的重写规则有什么问题有任何想法吗?关于如何解决问题的任何建议?
2017 年 4 月 27 日更新:
也许这与我的服务器配置有关?我让 Nging 在 Apache 前面以代理模式运行,上面列出的指令已设置为 Apache 的 HTTP/HTTPS 指令。
这是我在将日志级别提高到“调试”时在日志中看到的内容:
[Thu Apr 27 13:26:38.858812 2017] [core:error] [pid 6671] [client 199.99.99.99:53115] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Thu Apr 27 13:26:38.861026 2017] [core:debug] [pid 6671] core.c(3518): [client 199.99.99.99:53115] AH00121: r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:38.861052 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:38.861061 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:38.861067 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:38.861073 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:38.861079 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:38.861085 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:38.861091 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:38.861155 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:38.861163 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:38.861169 2017] [core:debug] [pid 6671] core.c(3525): [client 199.99.99.99:53115] AH00122: redirected from r->uri = /fees.php
[Thu Apr 27 13:26:39.257662 2017] [core:error] [pid 6669] [client 199.99.99.99:53116] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.
[Thu Apr 27 13:26:39.257711 2017] [core:debug] [pid 6669] core.c(3518): [client 199.99.99.99:53116] AH00121: r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:39.257718 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:39.257722 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:39.257726 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:39.257730 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:39.257734 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:39.257737 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:39.257741 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:39.257744 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:39.257748 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r->uri = /error_docs/banned.html
[Thu Apr 27 13:26:39.257751 2017] [core:debug] [pid 6669] core.c(3525): [client 199.99.99.99:53116] AH00122: redirected from r->uri = /favicon.ico
【问题讨论】:
标签: apache .htaccess mod-rewrite