fix: resolve 404 by setting nixpacks root and simplifying nginx config
This commit is contained in:
@@ -2,7 +2,7 @@ server {
|
|||||||
listen 80;
|
listen 80;
|
||||||
server_name _;
|
server_name _;
|
||||||
root /app;
|
root /app;
|
||||||
index index.php index.html index.htm;
|
index index.html index.php;
|
||||||
|
|
||||||
# GZIP Compression
|
# GZIP Compression
|
||||||
gzip on;
|
gzip on;
|
||||||
@@ -14,29 +14,24 @@ server {
|
|||||||
# Browser Caching
|
# Browser Caching
|
||||||
location ~* \.(jpg|jpeg|png|gif|webp|svg|ico|cur|gz|svgz|mp4|ogg|ogv|webm|htc)$ {
|
location ~* \.(jpg|jpeg|png|gif|webp|svg|ico|cur|gz|svgz|mp4|ogg|ogv|webm|htc)$ {
|
||||||
expires 1y;
|
expires 1y;
|
||||||
access_log off;
|
|
||||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~* \.(css|js)$ {
|
location ~* \.(css|js)$ {
|
||||||
expires 1M;
|
expires 1M;
|
||||||
access_log off;
|
|
||||||
add_header Cache-Control "public, max-age=2592000, immutable";
|
add_header Cache-Control "public, max-age=2592000, immutable";
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~* \.(woff|woff2|ttf|otf|eot)$ {
|
location ~* \.(woff|woff2|ttf|otf|eot)$ {
|
||||||
expires 1y;
|
expires 1y;
|
||||||
access_log off;
|
|
||||||
add_header Cache-Control "public, max-age=31536000, immutable";
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
||||||
}
|
}
|
||||||
|
|
||||||
# HTML - Short cache
|
location / {
|
||||||
location ~* \.(html|htm)$ {
|
try_files $uri $uri/ /index.html /index.php?$query_string;
|
||||||
expires 1h;
|
|
||||||
add_header Cache-Control "public, max-age=3600, must-revalidate";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# PHP Handling
|
# PHP Handling (Nixpacks default fastcgi path)
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
fastcgi_pass 127.0.0.1:9000;
|
fastcgi_pass 127.0.0.1:9000;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
@@ -44,9 +39,5 @@ server {
|
|||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri $uri/ /index.html /index.php?$query_string;
|
|
||||||
}
|
|
||||||
|
|
||||||
error_page 404 /404.html;
|
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