我在端口3000上的Ubuntu Amazon EC2实例上运行了一个Web服务器。15.0.0.10
是此EC2实例的私有IP。
在我进入此实例并运行以下命令curl localhost:3000/index.html
之后,它返回了我的index.html页面的html源代码。
但是当我运行curl 15.0.0.10:3000/index.html
时,它说:
curl: (7) couldn't connect to host
答案 0 :(得分:2)
如果您需要通过解决实例的任何 IP来访问服务器,则需要确保服务器在0.0.0.0上运行。
如果您已在localhost(127.0.0.1)上启动它,则会出现该行为。您可以停止服务器并重新启动它以绑定到0.0.0.0:3000。事情应该有效。