我有一个 Web 服务器在端口 3000 的 Ubuntu Amazon EC2 实例上运行.15.0.0.10 是此 EC2 实例的私有 ip.
I have a web server running on an Ubuntu Amazon EC2 instance at port 3000. 15.0.0.10 is the private ip of this EC2 instance.
在我通过 ssh 进入这个实例并运行以下命令 curl localhost:3000/index.html 后,它会返回我的 index.html 页面的 html 源代码.
After I ssh into this instance and run the following command curl localhost:3000/index.html, it returns me the html source of my index.html page.
但是当我运行 curl 15.0.0.10:3000/index.html 时,它说:
But when I run curl 15.0.0.10:3000/index.html, it says :
curl: (7) couldn't connect to host如果您需要通过寻址任何 IP 来访问服务器,您需要确保服务器在 0.0.0.0 上运行实例.
You need to ensure that the server is running on 0.0.0.0 if you need it to be reachable by addressing any IP of the instance.
如果您已在 localhost (127.0.0.1) 上启动它,则该行为是正常的.您可以停止服务器并重新启动它以绑定到 0.0.0.0:3000.一切正常.
If you have started it on localhost (127.0.0.1), then the behavior is expected. You can stop the server and re-start it to bind to 0.0.0.0:3000. Things should work.
更多推荐
卷曲亚马逊 EC2 实例
发布评论