转自:http://www.server110.com/nginx/201407/10794.html

把nginx装在CentOS上,用本机访问虚拟机的时候却出现了不能访问的问题,查了资料以后,原来是防火墙的问题。
具体情况如下:
防火墙可以ping通虚拟机,虚拟机也可以ping通防火墙。
接着检查了服务器端的80端口是否可以访问的到:telnet 192.168.131.130 80, 结果访问不到,原来果真防火墙的问题。
做如下处理:

[root@localhost html]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT  
[root@localhost html]# /etc/init.d/iptables save  
[root@localhost html]# /etc/init.d/iptables restart

  

至此,OK了,主机已可访问虚拟机的nginx服务。

 或者直接编辑防火墙配置文件

#vim /etc/sysconfig/iptables

  

相关文章:

  • 2021-10-13
  • 2022-01-07
  • 2021-06-12
  • 2022-12-23
  • 2021-05-24
  • 2021-12-20
  • 2021-06-18
猜你喜欢
  • 2021-12-19
  • 2021-11-27
  • 2022-01-17
  • 2021-12-06
  • 2022-02-27
  • 2021-07-09
相关资源
相似解决方案