From d67a51db180bc809966f4307d025467b88637679 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar Date: Sun, 8 Mar 2026 15:09:42 +0100 Subject: [PATCH] Add nginx config for VitePress SPA routing Co-Authored-By: Claude Opus 4.6 --- Dockerfile.docs | 2 ++ docs/nginx.conf | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 docs/nginx.conf diff --git a/Dockerfile.docs b/Dockerfile.docs index 4b409d9..a6366ab 100644 --- a/Dockerfile.docs +++ b/Dockerfile.docs @@ -8,5 +8,7 @@ COPY docs/ . RUN npm run build FROM nginx:alpine +RUN rm /etc/nginx/conf.d/default.conf +COPY docs/nginx.conf /etc/nginx/conf.d/default.conf COPY --from=builder /app/.vitepress/dist /usr/share/nginx/html EXPOSE 80 diff --git a/docs/nginx.conf b/docs/nginx.conf new file mode 100644 index 0000000..27c304f --- /dev/null +++ b/docs/nginx.conf @@ -0,0 +1,15 @@ +server { + listen 80; + server_name _; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ $uri.html /index.html; + } + + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { + expires 1y; + add_header Cache-Control "public, immutable"; + } +}