Example.com is found, but not www.example.com

Well this looks so simple in the nginx manual. I have cleared the
browser
cache. so I am running out of simple idea. The domain is
inplanesight.org.
http://www.inplanesight.org will 404
http://inplanesight.org works fine

Here is the server part of the nginx.conf file:

server {
listen 80;
server_name inplanesight.org www.inplanesight.org;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;
     access_log /var/log/nginx/access.log;

     root   /usr/local/www/nginx;
    location / {
        try_files $uri $uri/ =404;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/local/www/nginx-dist;
    }

    # proxy the PHP scripts to Apache listening on 127.0.0.1:80
    #
    #location ~ \.php$ {
    #    proxy_pass   http://127.0.0.1;
    #}

    location ~ \.php$ {
         try_files $uri =404;
         fastcgi_split_path_info ^(.+\.php)(/.+)$;
         fastcgi_pass unix:/var/run/php-fpm.sock;
         fastcgi_index index.php;
         fastcgi_param SCRIPT_FILENAME $request_filename;
         include fastcgi_params;
}

    # pass the PHP scripts to FastCGI server listening on

127.0.0.1:9000
#
#location ~ .php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME
/scripts$fastcgi_script_name;
# include fastcgi_params;
#}

    # deny access to .htaccess files, if Apache's document root
    # concurs with nginx's one
    #
    #location ~ /\.ht {
    #    deny  all;
    #}
}

If it matters, I have two active server sections in the nginx.conf file.
This is the start of the second section:

Well this looks so simple in the nginx manual. I have cleared the browser
cache. so I am running out of simple idea. The domain is inplanesight.org.
http://www.inplanesight.org will 404
http://inplanesight.org works fine

It’s a dns problem - www.inplanesight.org doesn’t resolve
DNS Lookup for www.inplanesight.org

rr

You need to point www.inplanesight.org to the same IP as
inplanesight.org.

You can also make an A record in your DNS for *.inplanesigt.org which
will
act as a “catch all” for any subdomain.

Thanks all. I will not use the catch all but will enter the
www.example.com
in the name server.

I spent some time reading up on Nginx to be er um less stupid, but
should
have spent more time on DNS. :wink:

Posted at Nginx Forum:

Catch-all records are not to be advised.

​Use a CNAME for www subdomain pointing to the ​base domain, rather than
another A record (easier maintenance… CNAME are here for a reason!).

​Definitely not a nginx problem though…​

B. R.

On Mon, May 18, 2015 at 8:07 AM, Nikolaj S. [email protected]