fix: resolve 404 by setting nixpacks root and simplifying nginx config
This commit is contained in:
@@ -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
3
nixpacks.toml
Normal file
@@ -0,0 +1,3 @@
|
||||
[variables]
|
||||
NIXPACKS_PHP_ROOT_DIR = "/app"
|
||||
NIXPACKS_PHP_FALLBACK_PATH = "/index.html"
|
||||
Reference in New Issue
Block a user