2

This didn't work for some reason:

server {
    listen       80;
    server_name  localhost;

    location / {
        root   html;
        index  index.html index.htm;
    }
    ...
}

I got

Failed to connect ... port 80: Connection refused

(I tested that nginx was running and port 80 was taken by it)

I then changed listen directive to:

listen [::]:80;

and it worked...

but I have further problems with other servers, for example:

server {
  #listen       80;
  listen [::]:80;
  server_name project.dev;

  location / {
    try_files $uri $uri.html $uri/index.html;
    root /Users/david/project;
    index  index.html index.htm;
  }
}

I put project.dev in /etc/hosts:

127.0.0.1       project.dev

but here I get

curl: (7) Failed to connect to project.dev port 80: Connection refused

no matter what...

I didn't like it that I have to specify ip6 ([::]) in the first place, but now I like it even less because it doesn't even work with other server directives except the main one...

How to get out of this mess?

davidhq
  • 215
  • 2
  • 9

0 Answers0