location ^~ /{{HOST}}/ { alias "{{PATH}}/"; index index.php index.html; autoindex on; # Try the literal URI, then directory (checks for index), then fallback to root index.php try_files $uri $uri/ /{{HOST}}/index.php?$query_string; # PHP handling nested INSIDE the alias location to maintain context location ~ \.php$ { fastcgi_pass 127.0.0.1:{{PHP_PORT}}; fastcgi_index index.php; # Correctly use $request_filename for alias compatibility include "{{CONF_DIR}}/fastcgi_params"; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param DOCUMENT_ROOT $document_root; # Optional parameters for frameworks fastcgi_param PATH_INFO $fastcgi_path_info; } }