linux - 服务器端node.js请求无法连接到主机

标签 linux node.js debian server

我尝试使用服务器端node.js并为http请求编写一个简单的通用javascript代码

var sys = require("sys"),
    http = require("http");

http.createServer(function(request, response) {
    response.sendHeader(200, {"Content-Type": "text/html"});
    response.write("Hello World!");
    response.close();
}).listen(1337);

sys.puts("Server running 8080");

当我在服务器上执行时,它可以工作并给我输出“Server running 8080”字符串。

但是当我检查浏览器时无法连接到主机。 (我试试这个http://myserverip:1337) 我打开1337端口但还是一样

最佳答案

Linux 上也是同样的情况。检查您的网络连接。如果您在亚马逊上,请检查您的安全组。有东西阻塞了该端口。

关于linux - 服务器端node.js请求无法连接到主机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28908797/

相关文章:

php - 无法在 PHP 中打开 session

linux - Linux 中的所有者和用户

regex - 使用 Sed 获取开始字符和结束字符之间的所有字符

javascript - node.js 和路由 : emit by class

javascript - Websockets(ws)、Node Js 集群、

regex - 将电子邮件从文件文件夹提取到新文件

linux - Bash 脚本 : expansion of argument not using $@ or $*

linux - Linux 中的 do_div() 是否适用于 32 位和 64 位架构?

node.js - 在 Node 中获取 100 个 zip 文件

opencv - 在不运行 X 的情况下在 opencv 中使用 imshow