diff --git a/nginx.template.conf b/nginx.template.conf index ed2ed5c..eeb93d9 100644 --- a/nginx.template.conf +++ b/nginx.template.conf @@ -82,7 +82,7 @@ http { # Static assets for pancake/third_party location /pancake/third_party { - alias /var/www/html/pancake/third_party; + alias ${NIXPACKS_PHP_ROOT_DIR}/pancake/third_party; expires 1y; add_header Cache-Control "public, immutable"; @@ -93,16 +93,22 @@ http { } } - # PHP application for /pancake + # PHP application for /pancake with pretty URLs location /pancake { - try_files $uri $uri/ /pancake/index.php?$query_string; + # First try to serve the requested file/directory, then fallback to index.php + try_files $uri $uri/ @pancake_fallback; + } + + # Fallback location for Pancake pretty URLs + location @pancake_fallback { + rewrite ^.*$ /pancake/index.php last; } # Handle PHP files location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; - fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include $!{nginx}/conf/fastcgi_params; include $!{nginx}/conf/fastcgi.conf; }