From 9f35d89961677b1f227d69c1134bdbb8d8d67e6c Mon Sep 17 00:00:00 2001 From: wonder Date: Thu, 28 May 2026 15:40:52 +0800 Subject: [PATCH] fix: add nginx SPA fallback to resolve deck 404 on direct URL access Co-Authored-By: Claude Opus 4.7 --- .gitea/workflows/deploy.yaml | 2 ++ nginx.conf | 10 ++++++++++ 2 files changed, 12 insertions(+) create mode 100644 nginx.conf diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index 42901d6..7277ce3 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -37,4 +37,6 @@ jobs: --restart unless-stopped \ -p 8080:80 \ nginx:alpine + docker cp nginx.conf slides-nginx:/etc/nginx/conf.d/default.conf docker cp dist/. slides-nginx:/usr/share/nginx/html/ + docker exec slides-nginx nginx -s reload diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..c787c9f --- /dev/null +++ b/nginx.conf @@ -0,0 +1,10 @@ +server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ $uri/index.html /index.html; + } +}