我通过 ssh 连接到 VPN(Linux 计算机)并在那里调用以下命令:
sibi::bash-> python -m SimpleHTTPServer
Serving HTTP on 0.0.0.0 port 8000 ...
然后,我通过它的 URL 访问它:http://x.x.x.x:8000浏览器向我提示它无法连接。
如何调试这个问题?
(Apache的测试页面在 http://x.x.x.x 中工作正常)
更新:IP 规则 (iptables -L -n)
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
target prot opt source destination
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
最佳答案
这显然是防火墙问题。
刷新iptables
有助于解决问题:
sudo iptables -F
但请小心,您可能需要为 VPN 服务器设置适当的防火墙规则。
关于python - SimpleHTTPServer 不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20071325/