title: try_files, alias, and regexp locations
body: <p>I have a regexp location for a subdirectory (<code>/foo</code>) and want Nginx to do this for a request to <code>/foo/bar</code>:</p>
  
  <ol>
  <li>Check if <code>bar</code> is a file or directory in the root defined in the location. If it is a directory, check for the index file.</li>
  <li>If there is no file or directory <code>bar</code> fallback to the given URI (there is another working handler for .php files).</li>
  </ol>
  
  <p>It looks like this:</p>
  
  <pre><code>location ~ ^/foo(/.*)?$ {
    root /my/root/with/files;
    index index.php;
    try_files $1 $1/ /my/root/with/files/index.php?$args;
  }
  </code></pre>
  
  <p>Should be simple, but I can't get this working, and the documentation does not help. I tried many combinations of <code>alias</code>, <code>root</code> and whatever.</p>
  
  <p>Any suggestions, how to get this working? Or do you know where to get useful documentation about try_files, root, alias, locations (including notes about outstanding bugs)?</p>