Apache2在Cloudflare反向代理后 - “URL对Google不可用”获取失败:爬取异常
创始人
2024-09-05 07:30:46
0

当使用Apache2作为Web服务器,并通过Cloudflare进行反向代理时,可能会遇到"URL对Google不可用"或"获取失败:爬取异常"的错误。这通常是由于Cloudflare的安全策略导致的。

以下是解决此问题的一些可能方法,包含代码示例:

  1. 确保Apache2的日志级别设置为debug,以便更详细地查看错误日志。可以通过编辑Apache2的配置文件/etc/apache2/apache2.conf,将以下行添加到文件中:
LogLevel debug
  1. 在Apache2的虚拟主机配置中,添加mod_remoteip模块以解析真实的客户端IP地址。这可以通过编辑虚拟主机配置文件(通常是/etc/apache2/sites-available/000-default.conf)来完成,将以下行添加到标签中:
RemoteIPHeader CF-Connecting-IP
RemoteIPTrustedProxy 103.21.244.0/22
RemoteIPTrustedProxy 103.22.200.0/22
RemoteIPTrustedProxy 103.31.4.0/22
RemoteIPTrustedProxy 104.16.0.0/12
RemoteIPTrustedProxy 108.162.192.0/18
RemoteIPTrustedProxy 131.0.72.0/22
RemoteIPTrustedProxy 141.101.64.0/18
RemoteIPTrustedProxy 162.158.0.0/15
RemoteIPTrustedProxy 172.64.0.0/13
RemoteIPTrustedProxy 173.245.48.0/20
RemoteIPTrustedProxy 188.114.96.0/20
RemoteIPTrustedProxy 190.93.240.0/20
RemoteIPTrustedProxy 197.234.240.0/22
RemoteIPTrustedProxy 198.41.128.0/17
RemoteIPTrustedProxy 2400:cb00::/32
RemoteIPTrustedProxy 2606:4700::/32
RemoteIPTrustedProxy 2803:f800::/32
RemoteIPTrustedProxy 2405:b500::/32
RemoteIPTrustedProxy 2405:8100::/32
  1. 在Apache2配置文件中,添加以下部分以允许Cloudflare的IP地址通过Apache2的访问控制列表(ACL):

    Require all granted
    Allow from 103.21.244.0/22
    Allow from 103.22.200.0/22
    Allow from 103.31.4.0/22
    Allow from 104.16.0.0/12
    Allow from 108.162.192.0/18
    Allow from 131.0.72.0/22
    Allow from 141.101.64.0/18
    Allow from 162.158.0.0/15
    Allow from 172.64.0.0/13
    Allow from 173.245.48.0/20
    Allow from 188.114.96.0/20
    Allow from 190.93.240.0/20
    Allow from 197.234.240.0/22
    Allow from 198.41.128.0/17
    Allow from 2400:cb00::/32
    Allow from 2606:4700::/32
    Allow from 2803:f800::/32
    Allow from 2405:b500::/32
    Allow from 2405:8100::/32

  1. 在Cloudflare的设置中,禁用"防火墙"和"爬虫"功能,以便允许Apache2与Google的爬虫进行通信。

这些方法应该有助于解决"URL对Google不可用"或"获取失败:爬取异常"的错误。请根据您的具体环境和需求进行调整和测试。

相关内容

热门资讯

透视教学!wpk透视工作室,w... 透视教学!wpk透视工作室,wpk模拟器多开,我来教教你(有挂规律)1、首先打开wpk模拟器多开最新...
透视辅助!wpk有那种辅助吗,... 透视辅助!wpk有那种辅助吗,wpk有作弊吗,安装教程(有挂方法)运wpk有那种辅助吗辅助工具,进入...
透视有挂!wpk免费辅助,wp... 透视有挂!wpk免费辅助,wpk真吗,切实教程(有挂解密)1、完成wpk免费辅助的残局,帮助玩家取得...
透视工具!wpk模拟器是什么,... 透视工具!wpk模拟器是什么,wpk透视是真的吗,力荐教程(有挂解密)小薇(透视辅助)致您一封信;亲...
透视计算!wpk俱乐部辅助器,... 透视计算!wpk俱乐部辅助器,wpk私人局有透视吗,辅助教程(有挂详情);一、wpk私人局有透视吗A...
透视最新!wpk安卓下载辅助,... 透视最新!wpk安卓下载辅助,wpk真吗,分享教程(有挂解说)1、下载好wpk安卓下载辅助辅助软件之...
透视规律!wpk刷入池率脚本,... 透视规律!wpk刷入池率脚本,wpk俱乐部怎么作弊,AI教程(有挂细节)1、wpk俱乐部怎么作弊系统...
透视软件!wpk辅助购买,wp... 透视软件!wpk辅助购买,wpk私人局有透视吗,存在挂教程(有挂插件);进入游戏-大厅左侧-新手福利...
透视中牌率!wpk有辅助器吗,... 透视中牌率!wpk有辅助器吗,wpk辅助,解说技巧(有挂方法)1、用户打开应用后不用登录就可以直接使...
透视辅助!wpk有那种辅助吗,... 透视辅助!wpk有那种辅助吗,如何下载wpk透视版,2025新版教程(有挂详情)1、进入游戏-大厅左...