0

I am running Ubuntu 20.04, and when I try to connect to localhost using curl with the command:

curl -v localhost

I get the result:

*   Trying 127.0.0.1:80...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> Host: localhost
> User-Agent: curl/7.68.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 404 Not Found
< Date: Sat, 22 Oct 2022 08:20:39 GMT
< Content-Type: text/html
< Content-Length: 146
< Connection: keep-alive
< 
<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>
* Connection #0 to host localhost left intact

Here's output from netstat -anpee | grep :80:

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      0          614515     -
tcp6       0      0 :::80                   :::*                    LISTEN      0          612479     -

What's wrong?

How do I fix it?

6
  • Can you check the output of curl -v http://localhost and share it?
    – Sinux
    Oct 22, 2022 at 9:16
  • Is there any app listening on port 80? Nginx? Apache? You can check it by netstat -anpee | grep :80
    – Sinux
    Oct 22, 2022 at 9:22
  • The output of curl -v http://localhost is exactly the same Oct 22, 2022 at 10:03
  • The output of netstat -anpee | grep :80 is : tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 0 614515 - tcp6 0 0 :::80 :::* LISTEN 0 612479 - Oct 22, 2022 at 10:05
  • I do not see the app that is listening on port 80, however, if it is indeed Nginx then @roaima 's answer is correct.
    – Sinux
    Oct 22, 2022 at 10:33

1 Answer 1

1

You've installed nginx on your local system and it's running. However, either it has virtual hosts that do not include localhost or you do not have a valid document root from which it can serve content.

Look in the webserver error log for further details.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .