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