简体   繁体   English

在 pm2 中更改进程的端口

[英]Changing PORT of a porcess in pm2

I have a process running in PORT 3000 and I want to deploy this process in any other PORT.我有一个在 PORT 3000 中运行的进程,我想在任何其他 PORT 中部署这个进程。 How can I do this?我怎样才能做到这一点?

This is a simple configuration for pm2:这是 pm2 的简单配置:

module.exports = {
  apps : [
      {
        name: "myapp",
        script: "./app.js",
        watch: true,
        instance_var: 'INSTANCE_ID',
        env: {
            "PORT": 3000,
            "NODE_ENV": "development"
        }
      }
  ]
}

There is an apps.env.PORT key you can use.您可以使用一个apps.env.PORT键。

PM2 does not decide your port, it's however the app PM2 is managing binds to the port is what you need to change. PM2 不会决定您的端口,但是 PM2 管理的应用程序绑定到端口是您需要更改的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM