Cloudflare 520错误|无法访问源站 Error 520 宝塔面板

发布于 2022-04-05  511 次阅读


本文最后更新于2022年5月1日,已超过 30 天没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!

这两天,很多人都莫名的被打了,CPU使用率直接上升 100%(好怕会爆炸)XD。。唯有套上Cloudflare 的免费cf节点分流一下,但是今天打算修改一下文章的时候,出现源网站 出现 520 错误,访问不了服务源。

报错信息:

Error 520 Ray ID: xdd5f1c9fc11axxc • 2022 04-05 06:31:12 UTC Web server is returning an unknown error What happened? There is an unknown connection issue between Cloudflare and the origin web server. As a result, the web page can not be displayed. What can I do? If you are a visitor of this website: Please try again in a few minutes. If you are the owner of this website: There is an issue between Cloudflare's cache and your origin web server. Cloudflare monitors for these errors and automatically investigates the cause. To help support the investigation, you can pull the corresponding error log from your web server and submit it our support team. Please include the Ray ID (which is at the bottom of this error page). Additional troubleshooting resources.

看到这个报错,还以为是网站有问题呢。测试后发现网站是正常的。仔细想了下,应该是宝塔免费防火墙脑残设定造成的。关掉了免费nginx防火墙访问终于正常了。

问题原因:

开了cdn 没有导入cf的IP白名单 导致了CF无法访问源站。

解决办法:

  • 面板 → 软件商店 → 已安装插件→ Nginx免费防火墙
  • 点击防火墙的设置 → 全局设置 → IP白名单 → 设置

宝塔白名单导入CF所有IP地址

复制下面直接贴上即可。

[["131.0.72.0","131.0.75.255"],["172.64.0.0","172.71.255.255"],["104.16.0.0","104.31.255.255"],["162.158.0.0","162.159.255.255"],["198.41.128.0","198.41.255.255"],["197.234.240.0","197.234.243.255"],["188.114.96.0","188.114.111.255"],["190.93.240.0","190.93.255.255"],["108.162.192.0","108.162.255.255"],["141.101.64.0","141.101.127.255"],["103.31.4.0","103.31.7.255"],["103.22.200.0","103.22.203.255"],["103.21.244.0","103.21.247.255"],["173.245.48.0","173.245.63.255"]]

CF|cloudflare CDN 的IP-官网

https://www.cloudflare.com/ips/
IPv4
  • 103.21.244.0/22
  • 103.22.200.0/22
  • 103.31.4.0/22
  • 104.16.0.0/13
  • 104.24.0.0/14
  • 108.162.192.0/18
  • 131.0.72.0/22
  • 141.101.64.0/18
  • 162.158.0.0/15
  • 172.64.0.0/13
  • 173.245.48.0/20
  • 188.114.96.0/20
  • 190.93.240.0/20
  • 197.234.240.0/22
  • 198.41.128.0/17
IPv6
  • 2400:cb00::/32
  • 2606:4700::/32
  • 2803:f800::/32
  • 2405:b500::/32
  • 2405:8100::/32
  • 2a06:98c0::/29
  • 2c0f:f248::/32