今天申请了个vps,首先安装了一遍 删除的LNMP, 安装好后无法访问,觉得奇怪,然后重装VPS再安装了Licess的LNMP,仍然是无法访问,是连探针都无法访问的那种,并且没有显示NGINX那个错误页,想了一下会不会是防火墙开启了呢? 到论坛搜索到关闭的命令:- iptables -F复制代码

然后就能正常访问了,看来真是iptables的问题,这个公司提供的OS默认安装了iptables而且是关了几个重要的端口,再次重装VPS,把这个限制了访问的iptable的规则记录下来,大家看看:

  • [root@hhvps ~]# iptables -L
  • Chain INPUT (policy ACCEPT)
  • target prot opt source destination
  • RH-Firewall-1-INPUT all -- anywhere anywhere
  • - Chain FORWARD (policy ACCEPT)
  • target prot opt source destination
  • RH-Firewall-1-INPUT all -- anywhere anywhere
  • - Chain OUTPUT (policy ACCEPT)
  • target prot opt source destination
  • - Chain RH-Firewall-1-INPUT (2 references)
  • target prot opt source destination
  • ACCEPT all -- anywhere anywhere
  • ACCEPT icmp -- anywhere anywhere icmp any
  • ACCEPT esp -- anywhere anywhere
  • ACCEPT ah -- anywhere anywhere
  • ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
  • ACCEPT udp -- anywhere anywhere udp dpt:ipp
  • ACCEPT tcp -- anywhere anywhere tcp dpt:ipp
  • ACCEPT all -- anywhere anywhere state RELATED,ESTAB LISHED
  • ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:s sh
  • REJECT all -- anywhere anywhere reject-with icmp-ho st-prohibited
  • [root@hhvps ~]#复制代码

顺便贴另外一个公司的,iptables没有限制访问的规则做对比:

  • [root@high ~]# iptables -L
  • Chain INPUT (policy ACCEPT)
  • target prot opt source destination
  • ACCEPT udp -- anywhere anywhere udp dpt:ftp-data
  • ACCEPT udp -- anywhere anywhere udp dpt:ftp
  • ACCEPT udp -- anywhere anywhere udp dpt:domain
  • ACCEPT tcp -- anywhere anywhere tcp dpt:dnp
  • ACCEPT tcp -- anywhere anywhere tcp dpt:ndmp
  • ACCEPT tcp -- anywhere anywhere tcp dpt:https
  • ACCEPT tcp -- anywhere anywhere tcp dpt:http
  • ACCEPT tcp -- anywhere anywhere tcp dpt:imaps
  • ACCEPT tcp -- anywhere anywhere tcp dpt:imap
  • ACCEPT tcp -- anywhere anywhere tcp dpt:pop3s
  • ACCEPT tcp -- anywhere anywhere tcp dpt:pop3
  • ACCEPT tcp -- anywhere anywhere tcp dpt:ftp-data
  • ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
  • ACCEPT tcp -- anywhere anywhere tcp dpt:domain
  • ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
  • ACCEPT tcp -- anywhere anywhere tcp dpt:ssh
  • - Chain FORWARD (policy ACCEPT)
  • target prot opt source destination
  • - Chain OUTPUT (policy ACCEPT)
  • target prot opt source destination
  • [root@high ~]#复制代码

以后如果大家安装好环境,访问自己的vps没有出现错误页,并且过十几秒才显示页面无法打开的,就很哟可能是防火墙的问题了