How can I use the port 80 on my local Linux machine as the port of my node server?
The netstat command netstat -ptuln
says the following about this port, while the node server is running:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:80 0.0.0.0:* LISTEN -
I found on this site some recommendations for the command sudo iptables -I INPUT -p tcp -m tcp --dport 80 -j ACCEPT
. I executed this command but when I make a request with curl
(curl 1.97.xxx.xxx.xx
) it keeps responding with curl: (7) Failed to connect to xxxxxx port 80: Connection refused
.
But using curl the following ways works: curl 0.0.0.0:80
or curl localhost:80
.
My conclusion is, that I somehow have not opened the port correctly, but all I could find on the internet repetitively is the command I mentioned earlier.
I am aware of the fact that I could fix this easily by using an apache server, but I would like to make it without it.
Thank you!
Advertisement
Answer
Paste the output from
netstat -ptuln
command.I think the problem is that your web server runs on local address and can not be reachable for other machines in network.