0

我正在尝试在 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 地址。

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

4

0 回答 0