我有两个使用 node js 的网站。我希望这个站点在我编写 example-site1.com 时运行 8000 端口,在我编写 example-site2.com 时运行 2000 端口。
当我只写 IP:8000 或 IP:2000 时,它是正确的。
如何设置配置?
最佳答案
var ports = process.argv.splice(2)
var server = http.createServer(function (request, response) { }); server.listen(ports[0], function () { console.log('服务器监听端口'+ports[0]);
Node app.js 端口
关于node.js - 如何在 apache 服务器 8000 和 2000 端口运行 Node js?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52531394/