I'm new to using nginx, well, new to using anything that's not cpanel... I'm having problems getting domains to work using nginx when you include www. in the url.

www.mydomain.com > not work 404
mydomain.com > works

I'm not sure if I have made mistake with named config files, or the server config for nginx. I'm kinda learning in a hurry and I'm not going to be surprised if I made some error with basic configuration. I run latest nginx & php-fpm, apart from my domain issue it works.

I'm (trying?) to run subdomains, they work, but using www. will result in a 404. I use nameservers etc from my main .org server domain. I'm going to post all that is relevant below in the hope someone here can spot the errors I am making/or made.

etc/hosts 
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
184.xxx.xxx.146 server.servername.org servername.org 

named.conf

   ... 
   view "localhost_resolver" {
/* This view sets up named to be a localhost resolver ( caching only nameserver ).
 * If all you want is a caching-only nameserver, then you need only define this view:
 */
   # match-clients         { 127.0.0.0/24; };
   # match-destinations    { localhost; };
   match-clients      { any; };
   match-destinations { any; };
   recursion no;

        zone "servername.org" {
                type master;
                file "/var/named/servername.org.db";
        };

// optional - we act as the slave (secondary) for the delegated domain
zone "mydomain.com" IN {
  type slave;
  file "/var/named/mydomain.com.db";
  masters {10.10.0.24;};
}; 
allow-notify { 184.xxx.xxx.146; };
};

mydomain.com.db

$TTL    86400
mydomain.com.  IN      SOA     ns1.servername.org.      server.servername.org.      
Edit
Report