码迷,mamicode.com
首页 > Web开发 > 详细

不能访问虚拟机上的nginx网站

时间:2018-06-03 19:29:19      阅读:224      评论:0      收藏:0      [点我收藏+]

标签:init.d   server   bin   arp   vmw   vmware   htm   bsp   tle   

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

转自: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

  

不能访问虚拟机上的nginx网站

标签:init.d   server   bin   arp   vmw   vmware   htm   bsp   tle   

原文地址:https://www.cnblogs.com/achengmu/p/9129705.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!