Nginx subdomain configuration not being picked up/working

nginxsubdomain

I'm trying to setup a server block for a subdomain, but nginx doesn't seem to pick up the configuration (properly). What it does is just pickup the first configuration block available and set it as the appropriate configuration.

My DNS records are as following:
http://imgur.com/oJF46eU

My virtual host block looks like this:

server {
  listen 80;
  server_name stage.remykooistra.nl www.stage.remykooistra.nl;

  root /var/www/stage.remykooistra.nl;
  index index.html index.php;

  location / {
    try_files $uri $uri/ /index.php?$args;
  }

  location ~ /(cronjobs|config|lib|app/code){
    deny all;
    return 404;
  }

  location ~ \.php$ {
    include   /etc/nginx/fastcgi_params;
    fastcgi_pass unix:/var/run/php5-fpm.sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  }
}

This is basically the same setup I use for almost all my server blocks, with a few exceptions such as SSL and other denied folder etc..

I hope someone could point out what I'm doing wrong here because I'm really confused on why it just doesn't pick up the right configuration.

Best Answer

Bar some small DNS issues: http://dnscheck.pingdom.com/?domain=stage.remykooistra.nl everything seems OK so I wonder whether your Nginx conf has actually loaded. Check your filenames and restart Nginx.

Also, for www.stage. to work, you need another DNS record.