4
在托管Ubuntu的虚拟机,我有nginx的为http
和https
运行,并且可以访问那些使用从虚拟机内的公网IP:外部HTTP连接失败(开放的端口)
curl http://159.203.0.5
外面做同样的虚拟机发生故障 - 连接超时。
的端口是开放的:
[email protected]:~# 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的监听外部接口上:
[email protected]:~# 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
还能是什么呢?
是的,公共IP是129.203.0.5。我可以ping通它和SSH,但http和https没有对外提供任何响应。 –
入站流量可以被iptables限制,所以这是第一次检查。有时服务器上存在许多nginx二进制文件,并导致奇怪的行为。你确定它是监听的nginx(或者nginx二进制/进程)吗? netstat -tlnp | awk'/:80 */{split($ NF,a,“/”);打印[2],a [1]}'然后用“nginx -V”检查进程是否加载了正确的conf文件。在此检查后,请确保您没有配置问题(nginx.conf和/或专用配置文件)。你应该在问题中为你的配置文件添加一个链接。 –