我有一个 VPS(在 linode 上),我在上面安装了 Node.JS。
我的 server.js 文件如下:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337);
console.log('Server running on port 1337');
当我在我的服务器上尝试这个时:
wget http://localhost:1337
它确实能工作并下载响应。但在外部,Google Chrome 却说“哎呀!Google Chrome 无法连接到 xxx.xxx.xx.xx:1337”
这是 Iptables 的输出:
Chain INPUT (policy ACCEPT)
target prot opt source destination
fail2ban-ssh tcp -- anywhere anywhere multiport dports ssh
ACCEPT all -- anywhere anywhere
REJECT all -- anywhere loopback/8 reject-with icmp-port- unreachable
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere tcp dpt:www
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT icmp -- anywhere anywhere
LOG all -- anywhere anywhere limit: avg 5/min burst 5 LOG level debug prefix `iptables denied: '
DROP all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:4711
ACCEPT tcp -- anywhere anywhere tcp dpt:1337
ACCEPT tcp -- anywhere anywhere tcp dpt:1337
Chain FORWARD (policy ACCEPT)
target prot opt source destination
DROP all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere tcp spt:1337
Chain fail2ban-ssh (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere
可能出了什么问题?谢谢!
答案1
尝试另一个端口。3000 应该可以工作。