Ubuntu: Http server on port 80 starts up but cannot access from browser?

So, I have a web application running on http-servervia npm. In my file package.jsonI have a line "start": "sudo http-server -a [my ip address] -p 8065 -c-1"and my application is working fine when I go to http://myipaddress:8065. However, if I change 8065 to 80, in the json file (this is what I want), I still get a success message:

Starting up http-server, serving ./
Available on:
http://myipaddress:80

But when I get to the link, chrome will give me ERR_CONNECTION_REFUSED. Does anyone know what is going on?

+4
source share
5 answers

I would suggest that there are three possible problems.

  • Port 80 is already in use.
  • root ( < 1024, root)
  • http-server .

, 80,

netstat -lntu | grep :80

80 , -

tcp6       0      0 :::80                 :::*                    LISTEN

, 80 (apache? nginx?)


, 80, http- , npm i.e.

sudo http-server -a [my ip address] -p 80 -c-1

, npm root http- i.e.

sudo npm start

sudo package.json:

"start": "http-server -a [my ip address] -p 8065 -c-1"

, http- . w3m - .

, w3m sudo apt-get install w3m, .

  • . mkdir /tmp/testing
  • CD cd /tmp/testing
  • http- http-. -a localhost -p 1234
  • http://localhost:1234 w3m w3m http://localhost:1234/
  • http- http-. -a localhost -p 80
  • http://localhost w3m w3m http://localhost/, ?
+4

:

localhost, localhost 127.0.0.1, .

80, , ( ).

0

nodejs 1000 root-. sudo node app.js . , 80.

0

Apache? , 80 Apache?

In this case, it is better to redirect port 80 to your application server, which only runs it on the Apache port.

0
source

Is this error 102? Check out the link. This is probably caused by some extensions you have installed.

0
source

All Articles