我想将所有流量转发到 nginx 中的某个 URL 到 node.js。我还是 node.js 的新手,我想知道我是否应该使用某种 CGI 服务(如 PHP),或者我是否应该设置一个 node.js 服务器(如 nginx -> apache)并通过转发所有流量nginx 到该服务器,如下所示:
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");
这只是一个需要运行 node.js 脚本的页面。做这个的最好方式是什么?