【问题标题】:How can I run node js in apache server 8000 and 2000 port?如何在 apache 服务器 8000 和 2000 端口中运行节点 js?
【发布时间】:2019-03-03 00:55:17
【问题描述】:

我有两个带有节点 js 的网站。我希望这个站点在我编写 example-site1.com 时运行 8000 端口,并在我编写 example-site2.com 时运行 2000 端口。

当我只写 IP:8000 或 IP:2000 时,它的工作原理是正确的。

如何设置配置?

【问题讨论】:

    标签: node.js linux apache lamp


    【解决方案1】:

    var ports = process.argv.splice(2)

    var server = http.createServer(function (request, response) { }); server.listen(ports[0], function () { console.log('服务器监听端口'+ports[0]);

    节点 app.js 端口

    【讨论】:

      猜你喜欢
      • 2014-09-05
      • 1970-01-01
      • 2018-09-13
      • 2023-01-19
      • 2017-05-09
      • 1970-01-01
      • 2017-09-06
      • 1970-01-01
      • 2013-02-19
      相关资源
      最近更新 更多