我已经安装了Fedora 20和nginx1.4.7的VirtualBox 4.3.12。机器有桥接的网络接口,两种方式都可以执行:从主机(Windows 7)使用
ping 192.168.0.15 (虚拟机的ip地址)
和客服机
ping 192.168.0.10 (主机ip地址)
但我不能从主机上访问客服机的nginx。我读过这和这,并按照那些文章/之前提出的问题告诉我的那样做了,但我仍然无法从主机上查看nginx站点。
netstat -tnlp返回:
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 930/nginx: master p 发布于 2019-09-08 08:05:25
当我这么做的时候
iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT我犯了一个错误:
iptables: Index of insertion too big.原因是我没有任何策略,因此“输入4”部分试图在索引4处插入它应该是index = 1。要查看您的规则,请执行以下操作:
sudo iptables --list-rules然后在适当的索引处插入。(在大多数情况下):
sudo iptables -I INPUT 1 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT这件事终于成功了!
nginx conf文件是:
server {
listen 0.0.0.0:80;
location / {
proxy_pass http://localhost:9000;
}
}发布于 2019-06-03 10:41:29
我做了:
iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 8080 -j ACCEPT在VM的控制台中,它起作用了。
https://unix.stackexchange.com/questions/169148
复制相似问题