nginx is not passing fastcgi query string
<p>With some (or very much) trial and error i was able to modify my copy and pasted nginx fastcgi php configuration from somewhere years ago to be able to run my php application in a subfolder.</p>

<p>But the last final step i am not able to solve is how to get nginx to pass the query string to php to be able to access the GET parameters. This is my configuration mostly perfect with only the configuration parameters missing:</p>

<pre><code>server {
    listen      80;
    server_name project.dev;

    location /app/ {
        alias /path/to/my/application/;
        index index.php;
        try_files $uri $uri/ /app/index.php;

        location ~ \.php$ {
            include fastcgi_params;
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        }
    }

    location / {
        # configuration for static website
    }
}
</code></pre>

<p>I read that there are different options you have to pass to <code>try_files</code> to get request parameters:</p>

<ul>
<li><code>try_files $uri $uri/ /app/index.php$is_args$query_string;</code></li>
<li><code>try_files $uri $uri/ /app/index.php$is_args$args;</code></li>
<li><code>try_files $uri $uri/ /app/index.php?$query_string;</code></li>
</ul>

<p>Unfortunately changing it to any of these results in my php script no longer being found because nginx resets the request to it's document root:</p>

<pre><code>2016/11/25 11:54:48 [error] 45809#0: *1169 open() "/usr/local/Cellar/nginx-full/1.10.2/htmlindex.php" failed (2: No such file or directory), client: 127.0.0.1, server: project.dev, request: "GET /app/myurl?test=works HTTP/2.0", host: "project.dev", referrer: "http://project.dev/app/myurl?test=works"
</code></pre>

<p>Providing an absolute path for <code>fastcgi_param SCRIPT_FILENAME</code> does not work too producting the same error. Even setting a <code>root</code> configuration on the <code>server</code> level does not work correctly, because the separating slash for the path and the <code>index.php</code> is omitted everytime. But (if possible) i would prefer without setting a root directory at the server level because this project is consisting of many different folders and applications on the filesystem sharing no common directory.</p>