我正在尝试从外部其本地网络。
我可以成功 ping 通它(ping my.subdomain.com
):
PING my.subdomain.com (ser.ver.ip.add) 56(84) bytes of data.
64 bytes from static.143.220.55.162.clients.your-server.de (ser.ver.ip.add): icmp_seq=1 ttl=53 time=14.8 ms
64 bytes from static.143.220.55.162.clients.your-server.de (ser.ver.ip.add): icmp_seq=2 ttl=53 time=15.4 ms
64 bytes from static.143.220.55.162.clients.your-server.de (ser.ver.ip.add): icmp_seq=3 ttl=53 time=15.1 ms
64 bytes from static.143.220.55.162.clients.your-server.de (ser.ver.ip.add): icmp_seq=4 ttl=53 time=15.1 ms
64 bytes from static.143.220.55.162.clients.your-server.de (ser.ver.ip.add): icmp_seq=5 ttl=53 time=15.4 ms
64 bytes from static.143.220.55.162.clients.your-server.de (ser.ver.ip.add): icmp_seq=6 ttl=53 time=15.6 ms
64 bytes from static.143.220.55.162.clients.your-server.de (ser.ver.ip.add): icmp_seq=7 ttl=53 time=15.5 ms
^C
--- my.subdomain.com ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6010ms
rtt min/avg/max/mdev = 14.833/15.263/15.577/0.243 ms
但无法成功卷曲(curl -m 5 my.subdomain.com
):
curl: (28) Connection timed out after 5000 milliseconds
从之内主机服务器,curl(curl -m 5 my.subdomain.com
)响应为:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
的输出sudo ufw status
是
Status: active
To Action From
-- ------ ----
80/tcp ALLOW Anywhere
443/tcp ALLOW Anywhere
443 ALLOW Anywhere
80 ALLOW Anywhere
22 ALLOW ser.ver.ip.add
80/tcp (v6) ALLOW Anywhere (v6)
443/tcp (v6) ALLOW Anywhere (v6)
443 (v6) ALLOW Anywhere (v6)
80 (v6) ALLOW Anywhere (v6)
的输出netstat -tulnp
是
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 80509/nginx: master
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 724/systemd-resolve
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 797/sshd: /usr/sbin
tcp6 0 0 :::5000 :::* LISTEN 102144/registry
tcp6 0 0 :::80 :::* LISTEN 80509/nginx: master
tcp6 0 0 :::22 :::* LISTEN 797/sshd: /usr/sbin
udp 0 0 127.0.0.53:53 0.0.0.0:* 724/systemd-resolve
udp 0 0 ser.ver.ip.add:68 0.0.0.0:* 722/systemd-network
这是什么意思?我怎样才能让 nginx 网络服务器从外部可访问?
答案1
@Gerald Schneider 是正确的,它是服务器前面的另一个防火墙,需要配置为允许端口 80 上的入站连接