【发布时间】:2017-11-26 21:05:13
【问题描述】:
生态系统.config.js
module.exports = {
/**
* Application configuration section
* http://pm2.keymetrics.io/docs/usage/application-declaration/
*/
apps : [
// First application
{
name : 'cms_stage',
script : 'www',
env: {
COMMON_VARIABLE: 'true',
PORT: 3001,
NODE_ENV: 'staging'
}
}
]
}
我有一个以PORT=3001 node www 开头的快速应用程序,它可以工作。但是使用 pm2 以上的配置它不会。 pm2 show 开始了,但是没有收听 3001
我尝试运行PORT=3001 pm2 start cms_stage、pm2 start cms_stage 和pm2 start ecosystem.config.js。
在 app.js 中像 app.set('port', process.env.PORT || 3000) 这样读取端口号
【问题讨论】: