title: nginx server block with Symfony2 on Linux
body: <p>I am attempting to create a server block in nginx that will allow me to access a Symfony installation on my computer from the url (symfony-project.dev). The installation sites in a folder called 'my_symfony' in '/var/www'.</p>
  
  <p>I see that the Symfony pages are served from within the 'web' folder in the Symfony file structure, from a file called 'app.php'.</p>
  
  <p>The problem I am having is when I try and access the url (symfony-project.dev) I have allocated to this server block, it attempts to download the files instead of serve them. I have added code in the server block to parse the files as php so not sure why this is happening?</p>
  
  <p>Here is my 'symfony.conf' file in 'sites-available':</p>
  
  <pre><code>server {
      listen 80;
      server_name symfony-project.dev;
  
      access_log /var/www/my_symfony/access.log;
      error_log /var/www/my_symfony/error.log debug;
      rewrite_log on;
  
      root /var/www/my_symfony/web;
      index app.php index.php index.html index.htm;
  
      location / {
          try_files $uri /app.php$is_args$args;
      }
  
      location ~ ^/(app_dev|config)\.php(/|$) 
      {
          fastcgi_pass unix:/var/run/php5-fpm.sock;
          fastcgi_split_path_info ^(.+\.php)(/.*)$;
          fastcgi_index app.php;
          include fastcgi_params;
          fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      }
  }
  </code></pre>
  
  <p>I have also created a symbolic link to this file in the 'sites-enabled folder'.</p>
  
  <p>Can anyone see why this is happening? I'm reasonably new to nginx so it's probably a glaring error!
  Thanks</p>