问题
I have a problem when deploying my node.js on a private server. I just can't access it when i type the ip:5000 in the browser. This is what netstat shows:
Destination Gateway Genmask Flags MSS Window irtt Iface
126.0.54.248 0.0.0.0 255.255.255.248 U 0 0 0 eth1
0.0.0.0 126.0.54.249 0.0.0.0 UG 0 0 0 eth1
And this is my node.js code:
var express = require('express');
var app = express();
var http = require('http');
var port = 5000;
var server = http.createServer(app);
server.listen(port, function(err) {
console.log(err, server.address()); // prints undefined { address: '0.0.0.0', family: 'IPv4', port: 5000 }
});
I also added the ip address in my hosts file. What am I doing wrong that I can not access the webserver?(Yes I have the node server running)
来源:https://stackoverflow.com/questions/18184798/how-to-set-node-js-as-a-service-on-a-private-servercant-access-the-node-appli