This commit is contained in:
mike
2025-12-17 16:25:23 +01:00
parent 531193eb0b
commit 051b2911e7
2 changed files with 14 additions and 1 deletions

View File

@@ -1,4 +1,5 @@
FROM nginx:alpine
COPY index.html /usr/share/nginx/html/
COPY 404.html /usr/share/nginx/html/
COPY favicon.ico /usr/share/nginx/html/
COPY nginx.conf /etc/nginx/conf.d/default.conf

View File

@@ -4,13 +4,25 @@ server {
root /usr/share/nginx/html;
index index.html;
# Favicon
location = /favicon.ico {
try_files /favicon.ico =204;
access_log off;
log_not_found off;
}
# Custom 404 page
error_page 404 /404.html;
location = /404.html {
internal;
}
# Enable clean URLs without .html extension
location / {
# Try the exact URI, then with .html, then as directory with index.html, then 404
try_files $uri $uri.html $uri/ =404;
}
location = /index.html {
try_files /index.html =404;
}