Par*_*ang 2 curl amazon-ec2 amazon-web-services
我在端口 3000 的 Ubuntu Amazon EC2 实例上运行了一个 Web 服务器15.0.0.10
。是这个 EC2 实例的私有 ip。
在我通过 ssh 进入这个实例并运行以下命令后curl localhost:3000/index.html
,它会返回我的 index.html 页面的 html 源代码。
但是当我运行时curl 15.0.0.10:3000/index.html
,它说:
curl: (7) couldn't connect to host
Run Code Online (Sandbox Code Playgroud)
如果您需要通过寻址实例的任何IP来访问服务器,则需要确保服务器在 0.0.0.0 上运行。
如果您已在 localhost (127.0.0.1) 上启动它,则该行为是正常的。您可以停止服务器并重新启动它以绑定到 0.0.0.0:3000。事情应该有效。
归档时间: |
|
查看次数: |
7005 次 |
最近记录: |