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不可用"或"获取失败:爬取异常"的错误。请根据您的具体环境和需求进行调整和测试。

相关内容

热门资讯

记者揭秘!智星菠萝辅助(透视辅... 记者揭秘!智星菠萝辅助(透视辅助)拱趴大菠萝辅助神器,扑克教程(有挂细节);模式供您选择,了解更新找...
一分钟揭秘!约局吧能能开挂(透... 一分钟揭秘!约局吧能能开挂(透视辅助)hhpoker辅助靠谱,2024新版教程(有挂教学);约局吧能...
透视辅助!wepoker模拟器... 透视辅助!wepoker模拟器哪个好用(脚本)hhpoker辅助挂是真的,科技教程(有挂技巧);囊括...
透视代打!hhpkoer辅助器... 透视代打!hhpkoer辅助器视频(辅助挂)pokemmo脚本辅助,2024新版教程(有挂教程);风...
透视了解!约局吧德州真的有透视... 透视了解!约局吧德州真的有透视挂(透视脚本)德州局HHpoker透视脚本,必胜教程(有挂分析);亲,...
六分钟了解!wepoker挂底... 六分钟了解!wepoker挂底牌(透视)德普之星开辅助,详细教程(有挂解密);德普之星开辅助是一种具...
9分钟了解!wpk私人辅助(透... 9分钟了解!wpk私人辅助(透视)hhpoker德州透视,插件教程(有挂教学);风靡全球的特色经典游...
推荐一款!wepoker究竟有... 推荐一款!wepoker究竟有透视(脚本)哈糖大菠萝开挂,介绍教程(有挂技术);囊括全国各种wepo...
每日必备!wepoker有人用... 每日必备!wepoker有人用过(脚本)wpk有那种辅助,线上教程(有挂规律);wepoker有人用...
玩家必备教程!wejoker私... 玩家必备教程!wejoker私人辅助软件(脚本)哈糖大菠萝可以开挂,可靠技巧(有挂神器)申哈糖大菠萝...