文件如下
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello Node.js\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
运行node hello_node.js后,通过127.0.0.1:8124和localhost:8124均能访问,但是换成本机的固定IP就无法访问。
这是为什么啊?
还有V2EX怎么贴代码。。。。
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello Node.js\n');
}).listen(8124, "127.0.0.1");
console.log('Server running at http://127.0.0.1:8124/');
运行node hello_node.js后,通过127.0.0.1:8124和localhost:8124均能访问,但是换成本机的固定IP就无法访问。
这是为什么啊?
还有V2EX怎么贴代码。。。。
