问题
I cant reach my node serve on port 3000. When I change port to 80 everything works well.
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:
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
for me everything looks ok?
来源:https://stackoverflow.com/questions/37723319/cant-reach-nodejs-on-port-3000-from-external-on-centos-7