简体   繁体   English

Windows上的node.js无法将请求提供给外部IP

[英]node.js on windows not serving requests to external IP

I deployed node.js to Amazon EC2 Windows instance. 我将node.js部署到了Amazon EC2 Windows实例。 Here is the js code which I run: 这是我运行的js代码:

require('http').createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(80);

It works perfectly when I am accessing http://localhost But it doesn't work when I'm trying to access the server through external IP: http://[external IP] 当我访问http:// localhost时,它可以正常工作,但是当我尝试通过外部IP访问服务器时,它不起作用:http:// [external IP]

when I run "netstat -ano" I can see this line: 当我运行“ netstat -ano”时,我可以看到以下行:

0.0.0.0:80

if I run IIS, then it adds two lines 如果我运行IIS,则会添加两行

0.0.0.0:80
[::]:80

What does [::] mean? 这是什么意思? And why it's not added when I run node.js? 以及为什么在运行node.js时未将其添加? I think, that is why node.js isn't serving requests to external IP. 我认为,这就是为什么node.js不将请求提供给外部IP的原因。 How can I make node.js work on Windows? 如何使node.js在Windows上工作?

(re-posting comment as answer) (重新发布评论作为答案)

You might have to reconfigure your firewall, it is probably configured too strict. 您可能必须重新配置防火墙,它的配置可能太严格。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM