title: nginx rewrite rules failing - causing 503 errors
body: <p>I have the following nginx 2 virtual hosts on Nginx 1.4.1 and it doesn't work. when I comment out the first virtual host it works fine. Below gives me a 503 error. </p>
  
  <p>Any ideas what I should try?</p>
  
  <pre><code>server {
    listen *:80;
    server_name website.co;
    rewrite ^(.*) http://www.website.co$1 permanent;
  }
  
  server {
    listen *:80;
    server_name www.website.co;
    index index.php;
    root /var/www/html/website.co;
    location ~ \.php$ {
      try_files $uri = 404;
      fastcgi_pass unix:/tmp/website.co.sock;
      fastcgi_index index.php;
      fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include fastcgi_params;
      fastcgi_intercept_errors on;
    }
  </code></pre>
  
  <p>}</p>
  
  <p>thankyou</p>