Add nginx config for VitePress SPA routing
All checks were successful
CI / Tests (push) Successful in 4m23s
CI / Format (push) Successful in 3s
CI / Clippy (push) Successful in 3m17s
CI / Security Audit (push) Successful in 1m37s

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sharang Parnerkar
2026-03-08 15:09:42 +01:00
parent 7e12d1433a
commit d67a51db18
2 changed files with 17 additions and 0 deletions

View File

@@ -8,5 +8,7 @@ COPY docs/ .
RUN npm run build RUN npm run build
FROM nginx:alpine 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 COPY --from=builder /app/.vitepress/dist /usr/share/nginx/html
EXPOSE 80 EXPOSE 80

15
docs/nginx.conf Normal file
View File

@@ -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";
}
}