fix: resolve 404 by setting nixpacks root and simplifying nginx config

This commit is contained in:
mstfyldz
2026-05-04 23:38:19 +03:00
parent 21b4188511
commit 3e3e327e03
2 changed files with 7 additions and 13 deletions

View File

@@ -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;
}

3
nixpacks.toml Normal file
View File

@@ -0,0 +1,3 @@
[variables]
NIXPACKS_PHP_ROOT_DIR = "/app"
NIXPACKS_PHP_FALLBACK_PATH = "/index.html"