卷曲Amazon EC2实例 [英] Curl amazon EC2 instance

查看:187
本文介绍了卷曲Amazon EC2实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Ubuntu Amazon EC2实例运行在端口3000的Web服务器 15.0.0.10 是这样的EC2实例的私有IP。

在我ssh到该实例,并运行以下命令卷曲本地主机:3000 / index.html的,它返回了我的index.html网页的HTML源代码。

但是当我运行卷曲15.0.0.10:3000/index.html ,它说:

 卷曲:(7)无法连接到主机
 

  1. 为什么会出现这种情况?
  2. 在我能做些什么,以使第二个命令也返回的内容?
解决方案

您需要确保服务器上运行0.0.0.0如果你需要它通过解决任何 IP的可到达实例。

如果你已经开始它在本地主机(127.0.0.1),则是正常现象。您可以停止服务器并重新启动它绑定到0.0.0.0:3000。事情应该工作。

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.

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.

But when I run curl 15.0.0.10:3000/index.html, it says :

curl: (7) couldn't connect to host

  1. Why is this happening ?
  2. What can I do to make the second command also return the content?

解决方案

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.

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.

这篇关于卷曲Amazon EC2实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆