Related to: https://github.com/Unitech/pm2/issues/456
How do I get pm2 to load on startup with elevated privileges? I'm trying to have it bind an app to port 80 but it fails unless I do pm2 kill && sudo pm2 start app.js.
Thanks
sudo pm2 start server.js
is indeed the solution to start on a port < 1000. Only root can bind to those ports so it's making sense to me.
Don't see the issue there.
If you really don't like pm2 executed as root, you can look for workarounds here:
I don't mind pm2 running as root, but even though I have it starting up in init.d (as root), pm2 ends up running without priviledges. For this reason it won't bind to port 80. The solution is that every time I boot the OS I need to run "pm2 kill; sudo pm2 start app.js".
I hope that makes sense.
Most helpful comment
I don't mind pm2 running as root, but even though I have it starting up in init.d (as root), pm2 ends up running without priviledges. For this reason it won't bind to port 80. The solution is that every time I boot the OS I need to run "pm2 kill; sudo pm2 start app.js".
I hope that makes sense.