VMware虚拟机上配置nginx后,本机无法访问问题(转载)

 

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

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

1
2
3
[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服务。

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

1
#vim /etc/sysconfig/iptables

猜你喜欢

转载自www.cnblogs.com/mkl34367803/p/10010079.html