Linux能Ping通却访问不了网站,但在服务器里能wget成功

蜗牛vps教程2021-08-1030260

今天配置一台Linux服务器,系统是Centos,配置完毕访问网站时却不成功,没有什么提示,就是网络不通,访问网页超时。Linux能Ping通却访问不了网站,但在服务器里能wget成功  第1张访问网页超时

不过,我在服务器里用wget命令访问网站时,却是成功的。

 Linux能Ping通却访问不了网站,但在服务器里能wget成功  第2张

wget命令访问网站成功

也即是说,外网访问不了网站,服务器里能访问。

这是什么原因呢?

后来我问了下客服,他叫我关了防火墙试试,关闭防火墙的命令是:

  • iptables stop

我没有这样操作,而是清空iptables规则,使用命令是:

  • iptables -F && iptables -X && iptables -Z

我之前更改过config安全配置文件,位置在:

  • /etc/selinux/config

使用代码是:

  • # This file controls the state of SELinux on the system.
  • # SELINUX= can take one of these three values:
  • # enforcing - SELinux security policy is enforced.
  • # permissive - SELinux prints warnings instead of enforcing.
  • # disabled - No SELinux policy is loaded.
  • # SELINUX=enforcing
  • SELINUX=disabled
  • # SELINUXTYPE= can take one of these two values:
  • # targeted - Targeted processes are protected,
  • # mls - Multi Level Security protection.
  • SELINUXTYPE=targeted

更改完毕,再访问网站,真的成功了!原来真是防火墙的问题!


评论

有免费节点资源,我们会通知你!加入纸飞机订阅群

×
天气预报查看日历分享网页手机扫码留言评论电报频道链接