location ^~ /{{HOST}}/ { alias "{{PATH}}"; index index.php index.html; autoindex on; if (!-e $request_filename) { rewrite ^/{{HOST}}/(.*)$ /{{HOST}}/index.php?$1 last; } location ~ \.php$ { # Using $request_filename to match the alias path correctly fastcgi_pass 127.0.0.1:{{PHP_PORT}}; fastcgi_index index.php; include "{{CONF_DIR}}/fastcgi_params"; fastcgi_param SCRIPT_FILENAME $request_filename; } }