From 3e3e327e03722c51e4f1b4757a5c1f7445f81eac Mon Sep 17 00:00:00 2001 From: mstfyldz Date: Mon, 4 May 2026 23:38:19 +0300 Subject: [PATCH] fix: resolve 404 by setting nixpacks root and simplifying nginx config --- nginx.template.conf | 17 ++++------------- nixpacks.toml | 3 +++ 2 files changed, 7 insertions(+), 13 deletions(-) create mode 100644 nixpacks.toml diff --git a/nginx.template.conf b/nginx.template.conf index f6eb8d8..fb0653e 100644 --- a/nginx.template.conf +++ b/nginx.template.conf @@ -2,7 +2,7 @@ server { listen 80; server_name _; root /app; - index index.php index.html index.htm; + index index.html index.php; # GZIP Compression gzip on; @@ -14,29 +14,24 @@ server { # Browser Caching location ~* \.(jpg|jpeg|png|gif|webp|svg|ico|cur|gz|svgz|mp4|ogg|ogv|webm|htc)$ { expires 1y; - access_log off; add_header Cache-Control "public, max-age=31536000, immutable"; } location ~* \.(css|js)$ { expires 1M; - access_log off; add_header Cache-Control "public, max-age=2592000, immutable"; } location ~* \.(woff|woff2|ttf|otf|eot)$ { expires 1y; - access_log off; add_header Cache-Control "public, max-age=31536000, immutable"; } - # HTML - Short cache - location ~* \.(html|htm)$ { - expires 1h; - add_header Cache-Control "public, max-age=3600, must-revalidate"; + location / { + try_files $uri $uri/ /index.html /index.php?$query_string; } - # PHP Handling + # PHP Handling (Nixpacks default fastcgi path) location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; @@ -44,9 +39,5 @@ server { include fastcgi_params; } - location / { - try_files $uri $uri/ /index.html /index.php?$query_string; - } - error_page 404 /404.html; } diff --git a/nixpacks.toml b/nixpacks.toml new file mode 100644 index 0000000..44d640f --- /dev/null +++ b/nixpacks.toml @@ -0,0 +1,3 @@ +[variables] + NIXPACKS_PHP_ROOT_DIR = "/app" + NIXPACKS_PHP_FALLBACK_PATH = "/index.html"