title: NGINX try_files + alias directives
body: <p>I'm trying to serve request to /blog subdirectory of a site with the php code, located in a folder outside document root directory. Here's my host config:</p>
  
  <pre><code>server {
      server_name  local.test.ru;
      root   /home/alex/www/test2;
  
      location /blog {
          alias   /home/alex/www/test1;
          try_files $uri $uri/ /index.php$is_args$args;
  
          location ~ \.php$ {
              fastcgi_split_path_info ^(/blog)(/.*)$;
              fastcgi_pass unix:/var/run/php5-fpm.sock;
              include fastcgi_params;
          }
      }
  }
  </code></pre>
  
  <p>And I get for requests like</p>
  
  <p>wget -O - <a href="http://local.test.ru/blog/nonExisting">http://local.test.ru/blog/nonExisting</a></p>
  
  <p>just a code of index.php file from /home/alex/www/test2/ folder.</p>
  
  <p>However, this config:</p>
  
  <pre><code>server {
      server_name  local.test.ru;
      root   /home/alex/www/test2;
  
      location /blog {
          alias   /home/alex/www/test1;
          try_files $uri $uri/ /blog$is_args$args;
          index index.php;
  
          location ~ \.php$ {
              fastcgi_split_path_info ^(/blog)(/.*)$;
              fastcgi_pass unix:/var/run/php5-fpm.sock;
              include fastcgi_params;
          }
      }
  }
  </code></pre>
  
  <p>gives me index.html file from /home/alex/www/test2/.
  Please give me a clue - why? And how can I force NGINX to process /home/alex/www/test1/index.php instead?</p>