在亚马逊ec2上运行nodejs

时间:2013-06-10 16:15:29

标签: node.js amazon-ec2 port firewall

我正在尝试在Amazon EC2实例上运行nodeJS服务器,但我无法公开访问它。

我已经阅读了几个有关此问题的SO问题以及一些博客文章,但没有解决方案适合我。 这是我的服务器配置:

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

这是iptables -l

的输出
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp dpt:4444
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:4444

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     tcp  --  anywhere             anywhere             tcp spt:4444

端口4444也会添加到实例的安全组中。

服务器启动后,运行curl localhost:4444回显预期的“简单服务器”。 但我无法连接到公共DNS / IP地址。

您知道哪个设置仍然缺失吗?

0 个答案:

没有答案