From 50d8eb31d6eedb450fd5d7e85c6979723a0deb7f Mon Sep 17 00:00:00 2001 From: Julien Calixte Date: Sat, 23 May 2026 16:52:12 +0200 Subject: [PATCH] fix(nginx): redirect unknown paths to homepage Drop the $uri/ directory step in try_files which triggered the default 403 page on directories without an index, and 302 any 403/404 back to /. --- nginx.conf | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/nginx.conf b/nginx.conf index 5bfcc78..1bd8b26 100644 --- a/nginx.conf +++ b/nginx.conf @@ -4,7 +4,7 @@ server { location / { root /usr/share/nginx/html; index index.html index.htm; - try_files $uri $uri.html $uri/index.html $uri/index.htm $uri/ =404; + try_files $uri $uri.html $uri/index.html $uri/index.htm =404; } location /.well-known/ { @@ -13,11 +13,7 @@ server { add_header Access-Control-Allow-Methods "GET, OPTIONS"; } - error_page 404 /404.html; - location = /404.html { - root /usr/share/nginx/html; - internal; - } + error_page 403 404 =302 /; error_page 500 502 503 504 /50x.html; location = /50x.html {