我在我的 CentOS 6.4 服务器中安装了 node.js 和 socket.io。它与 Apache 并行运行,以 Apache 作为主服务器(端口 80)
我写了一个简单的 Hello world 脚本来测试 node.js 的安装:
var http = require('http');
http.createServer(function (request, response) {
response.writeHead(200, {'Content-Type': 'text/plain'});
response.write('Hello World\n');
response.end();
}).listen(8088);
console.log('Server started');
如果我在命令行中运行它,我会得到“服务器已启动”。但是当我尝试通过网络浏览器访问它时,输入http://xxx.xxx.xxx.xxx:8088它永远不会加载。我尝试使用许多其他端口号但没有成功。我必须在我的服务器中使用 ips,但它们都不起作用,我的域地址也不在这些 ips 下。
我该如何解决?
编辑: node,js 安装在另一台服务器上,我正试图从该服务器外部通过 webbrowser 访问它。
谢谢!