Curl amazon EC2 instance

匿名 (未验证) 提交于 2019-12-03 02:29:01

问题:

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?

回答1:

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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!