无法访问端口8080上EC2(AWS) [英] Can't access port 8080 on EC2 (AWS)

查看:1060
本文介绍了无法访问端口8080上EC2(AWS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始一个新的AWS EC2实例。在该实例的安全组我添加了一个新的规则以打开端口8080。我也停止了实例上的iptables服务,每另一篇文章。因此,从理论上讲这个端口应该是敞开的。

我开始对8080我的RESTful服务,并能够通过卷曲访问本地。

当我进来,卷曲远程我得到一个错误说无法连接到主机。

我还需要检查,看看8080是真正的开放?

解决方案
  

我开始对8080我的RESTful服务,并能够通过卷曲访问本地。

什么样的​​技术是您的基于RESTful服务?

很多框架时下监听本地主机 127.0.0.1 )而已,无论是默认或通过他们的榜样手段,如见规范的Node.js 一(我知道端口 8080 提示对的Java / Tomcat的,反正):

VAR HTTP =需要('HTTP'); http.createServer(功能(REQ,RES){   res.writeHead(200,{内容类型:text / plain的'});   res.end(你好世界\ N'); })听(1337,127.0.0.1)。 的console.log('在http://127.0.0.1:1337/运行服务器);

通过启动这个生成的日志信息的服务器运行在http:// 127.0.0.1 :1337 / 的 - 被强调的部分是这里的关键,即服务器已配置为在IP地址听 127.0.0.1 只,而你试图通过你的公开的亚马逊EC2 IP地址

I just started a new AWS EC2 instance. In the instance's security group I added a new rule to open port 8080. I also stopped the iptables service on the instance, per another post. So in theory this port should be wide open.

I started my RESTful service on 8080 and was able to access it locally via curl.

When I come in with curl remotely I get an error saying it couldn't connect to the host.

What else should I check to see if 8080 is truly open?

解决方案

I started my RESTful service on 8080 and was able to access it locally via curl.

What kind of technology is your RESTful service based upon?

Many frameworks nowadays listen on localhost (127.0.0.1) only, be it by default or by means of their examples, see e.g. the canonical Node.js one (I realize that port 8080 hints towards Java/Tomcat, anyway):

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

The log message generated by starting this is Server running at http://127.0.0.1:1337/ - the emphasized part is key here, i.e. the server has been configured to listen on the IP address 127.0.0.1 only, whereas you are trying to connect to it via your public Amazon EC2 IP Address.

这篇关于无法访问端口8080上EC2(AWS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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