我无法通过端口3000访问我的节点服务。当我将端口更改为80时,一切正常。
nodesjs:
var express = require('express');
var app = express();
app.get('/', function (req, res) {
res.send('Hello World!');
});
app.listen(3000, '0.0.0.0', function () {
console.log('server listening on port 3000!');
});
防火墙:
firewall-cmd --zone=public --list-ports
3000/tcp
iptables的:
Chain IN_public_allow (1 references)
target prot opt source destination
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 ctstate NEW
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 ctstate NEW
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:3000 ctstate NEW
netstat的:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1047/sshd
tcp 0 0 0.0.0.0:3000 0.0.0.0:* LISTEN 8308/node
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1730/master
tcp6 0 0 :::22 :::* LISTEN 1047/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1730/master
对我来说一切都好看?