我正在使用AWS Linux运行EC2实例。 有一个网站在端口8888上运行,所以如果从虚拟机运行curl "http://127.0.0.1:8888/login"我收到的网站。
我想从外部访问它,所以我在附加到实例的安全组中创build了一条规则:
Custom TCP Rule TCP 8888 0.0.0.0/0
当我试图从我的浏览器或命令行访问它,我得到一个超时
curl "http://xx.yy.zz.ff:8888/login"
其中xx.yy.zz.ff是连接到实例的弹性IP(用于通过SSH连接到VM)。
有趣的是,如果我先执行SSH隧道,则可以通过http://localhost:8888/login访问它:
ssh -i my-key.pem -NL 8888:localhost:8888 [email protected]
如果我做sudo netstat -tulpn我得到
tcp 0 0 127.0.0.1:8888 0.0.0.0:* LISTEN 26531/python
如果我do sudo ss -aut | grep 8888 do sudo ss -aut | grep 8888我一无所获。
有任何想法吗?
tcp 0 0 127.0.0.1:8888 0.0.0.0:* LISTEN 26531/python
那么,你的答案。 你的web服务器(python进程)只能在你的localhost接口上监听。 因此,您需要重新configuration以侦听EC2的外部networking接口, 或者安装nginx作为反向代理。