feat: add nginx configuration template with dynamic project routing and php-fpm support
This commit is contained in:
@@ -17,7 +17,23 @@ http {
|
||||
index index.php index.html index.htm;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
# Try global root first, fallback to @project_fallback if not found
|
||||
error_page 404 = @project_fallback;
|
||||
try_files $uri $uri/ =404;
|
||||
}
|
||||
|
||||
# Handle root-relative asset requests from project folders
|
||||
location @project_fallback {
|
||||
# Skip for common non-project paths
|
||||
if ($uri ~* ^/(favicon\.ico|phpmyadmin|admin)) {
|
||||
return 404;
|
||||
}
|
||||
# Capture project slug from Referer header (e.g., http://localhost/my-project/...)
|
||||
if ($http_referer ~* "^https?://[^/]+/([^/]+)/") {
|
||||
set $proj_slug $1;
|
||||
rewrite ^(.*)$ /$proj_slug$1 last;
|
||||
}
|
||||
return 404;
|
||||
}
|
||||
|
||||
{{PROJECTS}}
|
||||
|
||||
Reference in New Issue
Block a user