pm2 cluster can't bind to port 80 but fork does

Created on 22 Oct 2015  ยท  1Comment  ยท  Source: Unitech/pm2

After running
sudo setcap 'cap_net_bind_service=+ep'which node``

to allow binding to port 80, 443, pm2 works perfectly in fork mode.

But in cluster mode, it gives Error: bind EACCES null:80
I'm using nvm v4.2.1

See the error below:

  pm2:satan Calling daemon method pm2:getMonitorData +1ms
  pm2:satan God notified +3ms
  pm2:satan God notified +0ms
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ App name โ”‚ id โ”‚ mode    โ”‚ pid   โ”‚ status โ”‚ restart โ”‚ uptime โ”‚ memory      โ”‚ watching โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ server   โ”‚ 0  โ”‚ cluster โ”‚ 21529 โ”‚ online โ”‚ 2       โ”‚ 0s     โ”‚ 29.070 MB   โ”‚ disabled โ”‚
โ”‚ server   โ”‚ 1  โ”‚ cluster โ”‚ 21554 โ”‚ online โ”‚ 2       โ”‚ 0s     โ”‚ 14.875 MB   โ”‚ disabled โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
 Use `pm2 show <id|name>` to get more details about an app
--no-daemon option enabled = do not exit pm2 CLI
PM2 daemon PID = 15141
  pm2:satan Calling daemon method pm2:getMonitorData +69ms
[PM2] Streaming realtime logs for [all] processes 

02:18:28 server-0 
Error: bind EACCES null:80
  at Object.exports._errnoException (util.js:874:11)
  at exports._exceptionWithHostPort (util.js:897:20)
  at cb (net.js:1299:16)
  at rr (cluster.js:588:14)
  at Worker.<anonymous> (cluster.js:558:9)
  at process.<anonymous> (cluster.js:710:8)
  at emitTwo (events.js:92:20)
  at process.emit (events.js:172:7)
  at handleMessage (internal/child_process.js:686:10)
  at Pipe.channel.onread (internal/child_process.js:440:11)

02:18:28 server-1 
Error: bind EACCES null:80
  at Object.exports._errnoException (util.js:874:11)
  at exports._exceptionWithHostPort (util.js:897:20)

pm2 --version
0.15.7

node --version
v4.2.1

uname -a
Linux ip-172-30-0-127 3.13.0-48-generic #80-Ubuntu SMP Thu Mar 12 11:16:15 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

Most helpful comment

Do a pm2 update once you did the command sudo setcap 'cap_net_bind_service=+ep' which node

else use authbind

>All comments

Do a pm2 update once you did the command sudo setcap 'cap_net_bind_service=+ep' which node

else use authbind

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phra picture phra  ยท  3Comments

getvega picture getvega  ยท  3Comments

shaunwarman picture shaunwarman  ยท  3Comments

ghost picture ghost  ยท  3Comments

FujiHaruka picture FujiHaruka  ยท  3Comments