Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Amazon EC2 Error: listen EACCES 0.0.0.0:80

I have already added the HTTP TCP Port 80 to the inbound rules, but I still get the error:

Error: listen EACCES 0.0.0.0:80
    at Object._errnoException (util.js:992:11)
    at _exceptionWithHostPort (util.js:1014:20)
    at Server.setupListenHandle [as _listen2] (net.js:1338:19)
    at listenInCluster (net.js:1396:12)
    at doListen (net.js:1505:7)
    at _combinedTickCallback (internal/process/next_tick.js:141:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
like image 830
John C Avatar asked Jun 25 '18 09:06

John C


4 Answers

You cannot run a process that listens on low ports (below 1024) without root privileges.

You either try to run as sudo, as stated above, or start to use a reverse proxy (nginx for instance), start the process on another port and use the reverse proxy to forward the calls from port 80 to whatever port you started the process on.

like image 89
Radu Diță Avatar answered Nov 16 '22 01:11

Radu Diță


The error code EACCES means you don't have proper permissions to run applications on that port. On Linux systems, any port below 1024 requires root access.

like image 25
Riven Li Avatar answered Nov 16 '22 01:11

Riven Li


You probably have to run your node.js script with sudo as you want to listen on port 80.

like image 19
Sam Avatar answered Nov 16 '22 02:11

Sam


you need to use reverse proxy to forward the calls from port 80 to 8080 for example.

like image 1
Ahmed Abuwarda Avatar answered Nov 16 '22 03:11

Ahmed Abuwarda