[英]PM2 port number express app
ecosystem.config.js ecosystem.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'
}
}
]
}
I have an express app when i start with PORT=3001 node www
, it works. 当我从
PORT=3001 node www
开始时,我有一个快速应用程序,它可以工作。 But with pm2 above config it doesn't. 但是上面的pm2却没有。 pm2 show started but it is not listening to 3001
pm2节目已开始,但未收听3001
I tried running PORT=3001 pm2 start cms_stage
, pm2 start cms_stage
and pm2 start ecosystem.config.js
. 我尝试运行
PORT=3001 pm2 start cms_stage
, pm2 start cms_stage
和pm2 start cms_stage
pm2 start ecosystem.config.js
。
reading port number like this app.set('port', process.env.PORT || 3000)
in app.js 在app.js中读取类似于此
app.set('port', process.env.PORT || 3000)
端口号
在用pm2 kill
杀死pm2之后工作了
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.