在托管的Ubuntu VM上,我运行http
和https
的nginx,并且可以从VM中访问使用公共IP的那些:
curl http://159.203.0.5
在VM外部执行相同操作失败 - 连接超时。
端口已打开:
root@production01:~# ufw status
Status: active
To Action From
-- ------ ----
22 ALLOW Anywhere
80 ALLOW Anywhere
443 ALLOW Anywhere
22 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
nginx正在监听外部接口:
root@production01:~# netstat -an | grep "LISTEN "
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:2003 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:2004 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:25 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:2812 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:8002 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
tcp6 0 0 :::25 :::* LISTEN
还有什么呢?
答案 0 :(得分:0)
我认为问题不在VM上,而是在您尝试连接到VM的计算机上。此机器上的其他连接是否正常工作?
看看这个:
foo@bar:~$ curl 159.203.0.5 -v
* Rebuilt URL to: 159.203.0.5/
* Hostname was NOT found in DNS cache
* Trying 159.203.0.5...
* Connected to 159.203.0.5 (159.203.0.5) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 159.203.0.5
> Accept: */*
>
< HTTP/1.1 404 Not Found
< X-Powered-By: Express
< X-Content-Type-Options: nosniff
< Content-Type: text/html; charset=utf-8
< Content-Length: 13
< Date: Tue, 02 Feb 2016 17:36:31 GMT
< Connection: keep-alive
<
Cannot GET /
* Connection #0 to host 159.203.0.5 left intact
我没有超时,这404对我来说很合适。