本地网络服务器中 运行 node.js 的问题
Problems to run node.js in a local network server
我在本地网络的 Debian 服务器中创建了一个简单的 node.js 服务器示例 运行。
当我在本地访问它时它可以工作,但是当我从其他机器使用它的 IP 时它就不会。
URL 找不到“http://192.168.2.220:3003”
我在这台服务器上还有其他项目,包括 80 端口的 Apache。
我的错误在哪里?
这项工作还需要做些什么吗?
以下是服务器示例:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('IT VORKS!\n');
}).listen(3003, '127.0.0.1');
console.log('Server running at http://127.0.0.1:3003/');
尝试以下操作:
- 检查防火墙设置。
- 使用
.listen(3003, '192.168.2.220');
代替.listen(3003, '127.0.0.1');
我在本地网络的 Debian 服务器中创建了一个简单的 node.js 服务器示例 运行。 当我在本地访问它时它可以工作,但是当我从其他机器使用它的 IP 时它就不会。
URL 找不到“http://192.168.2.220:3003”
我在这台服务器上还有其他项目,包括 80 端口的 Apache。 我的错误在哪里? 这项工作还需要做些什么吗?
以下是服务器示例:
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('IT VORKS!\n');
}).listen(3003, '127.0.0.1');
console.log('Server running at http://127.0.0.1:3003/');
尝试以下操作:
- 检查防火墙设置。
- 使用
.listen(3003, '192.168.2.220');
代替.listen(3003, '127.0.0.1');