我看到了上面的帖子。然后我运行了以下命令。但似乎 8080 在机器外部仍可访问。有人知道哪里出了问题吗?
$ netstat -tanpu | grep ":8080"
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 165.91.211.165:8080 0.0.0.0:* LISTEN 26098/python3
$ sudo iptables -I INPUT 1 -i eth0 -p tcp --dport 8080 -j ACCEPT
$ sudo iptables -nvL
Chain INPUT (policy ACCEPT 5039 packets, 935K bytes)
pkts bytes target prot opt in out source destination
0 0 ACCEPT tcp -- eth0 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:8080
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:25 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 reject-with icmp-port-unreachable
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5900
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5901
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5902
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5903
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5904
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5905
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5906
0 0 ACCEPT tcp -- * * 127.0.0.1 0.0.0.0/0 tcp dpt:5907
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5900 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5901 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5902 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5903 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5904 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5905 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5906 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:5907 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:143 reject-with icmp-port-unreachable
0 0 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:993 reject-with icmp-port-unreachable
答案1
您是否尝试从公司/大学外部访问此 URI,或者您的计算机与服务器位于同一网络中?如果您尝试从外部访问,我相信您的“浏览器”和服务器之间有防火墙。
另一点是您在 Web 服务器配置中定义 IP 地址(不是 0.0.0.0)。检查您的 IP 地址是否与此地址匹配,如果您通过 FQDN(server.corp.com)访问,则此名称是否解析正确的 IP 地址。