Linux Port 80 Not Open – How to Fix 404 Error When Using Curl

curlhttplinuxporttcp

Weird issue I'm facing currently! There is nothing running on port 80.

Still curl gives 404 page not found. I can telnet to port 80 and even start a container exposing port 80 (host). But no requests reaches the container!

Any idea what might be going on? How do I debug this?

$ netstat -tulpn | grep :80
tcp        0      0 0.0.0.0:8000            0.0.0.0:*               LISTEN      -                   
tcp6       0      0 :::8000                 :::*                    LISTEN      -                   
$ curl localhost
404 page not found

Best Answer

In addition to Matthew's comment suspecting internal nat redirect

  • iptables -vnL -t nat or nft list ruleset ip

perhaps you could directly inspect port 80. These are some of the ways to do that:

  • ss -4tlnp -o state LISTENING '( sport = :80 )'
  • lsof -i:80
  • do a verbose tcpdump
  • do a verbose portscan with nmap
  • or, be even more explicit when testing with curl, ie curl -v http://localhost:80
Related Topic