title: Setting sub-domains on Nginx
body: <p>I have 2 application installed on my server using Nginx:</p>
  
  <ol>
  <li>Rails application </li>
  <li>wordpress blog</li>
  </ol>
  
  <p>I want that the rails app will be accessible through: <strong>staging.mydomain.com</strong>
  and that the wordpress blog will be accessible through: <strong>blog.mydomain.com</strong></p>
  
  <p>the site works fine but when i try to access the blog i get "<em>welcome to nginx</em>" screen.</p>
  
  <p>here is my nginx config:</p>
  
  <pre><code>server {
       listen   80;
       server_name staging.mydomain.com;
       rails_env staging;
  
       access_log /srv/www/staging/www/logs/access.log;
       error_log /srv/www/staging/www/logs/error.log;
  
       location / {
            root   /srv/www/staging/www/current/trunk/web/public;
            passenger_enabled on;
            }
  
     }
     server {
          listen       80;
          server_name  blog.mydomain.com;
  
  
          try_files $uri $uri/ /index.php;
          access_log /srv/www/blog.mydomain.com/logs/access.log;
          error_log /srv/www/blog.mydomain.com/logs/error.log;
  
          location ~ \.php$ {
              root /srv/www/blog.mydomain.com;
              include        fastcgi_params;
              fastcgi_pass   localhost:53217;
              fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
  
          }
      }
  </code></pre>
  
  <p>any thought about what is wrong here?</p>