Http-server: serves on port 8080 but not port 80

Created on 27 Oct 2014  路  5Comments  路  Source: http-party/http-server

ubuntu@domU-12-31-39-09-9A-6D:~$ http-server -p 80

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EACCES
    at errnoException (net.js:904:11)
    at Server._listen2 (net.js:1023:19)
    at listen (net.js:1064:10)
    at net.js:1146:9
    at dns.js:72:18
    at process._tickCallback (node.js:419:13)
    at Function.Module.runMain (module.js:499:11)
    at startup (node.js:119:16)
    at node.js:906:3
ubuntu@domU-12-31-39-09-9A-6D:~$ http-server
Starting up http-server, serving ./ on: http://0.0.0.0:8080
Hit CTRL-C to stop the server
^Chttp-server stopped.

Most helpful comment

The first 1024 ports are reserved for root.

All 5 comments

I used netstat -tulpn to check for things blocking port 80.

The first 1024 ports are reserved for root.

That must have been it. I don't remember what I did to "fix" it but it's working now. Thanks!

Quick fix: To use http-server listening over port 80, you can to run it with the privileges of the root user:

$ sudo http-server -p 80

I ended up creating a proxy host with nginx and everything is fine. The port 80 requires, indeed, elevated privileges.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EvgeniGordeev picture EvgeniGordeev  路  4Comments

jiyinyiyong picture jiyinyiyong  路  6Comments

laughinghan picture laughinghan  路  5Comments

arthurkhlghatyan picture arthurkhlghatyan  路  3Comments

dumptyd picture dumptyd  路  4Comments