Reputation: 375
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. But with pm2 above config it doesn't. pm2 show started but it is not listening to 3001
I tried running PORT=3001 pm2 start cms_stage
, pm2 start cms_stage
and pm2 start ecosystem.config.js
.
reading port number like this app.set('port', process.env.PORT || 3000)
in app.js
Upvotes: 2
Views: 8600