How to specify a port number for pm2

可紊 提交于 2019-11-30 06:06:26

You can use environment variable. For example:

1) NODE_PORT=3002 pm2 start -I 0 app.js

2) Read value in app:

console.log(process.env.NODE_PORT);

Or, if you are build express app:

1) PORT=3002 pm2 start -I 0 ./bin/www

2) Express load PORT automatically at start application.

You need to use -- to tell pm2 to stop parsing his options and give the rest to the program, then when you spawn direct binary, you need to tell pm2 that you don't want to use nodejs, so :

pm2 start rethinkdb --interpreter none -- --port 8082

You see you need -- --port 8082

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!