mirror of
https://github.com/dong-nz/cv.git
synced 2026-11-23 00:20:40 +07:00
Repo side of spec-v4-deploy-infra: deploy-infra.yml (paths-filtered nginx redeploy, test-before-touch, health probe); compose.yaml rename + secrets/site_config entrypoint override; site identity externalized - SITE_URL/SITE_NAME read from env (site.ts, vite site-identity plugin, index.html tokens, generated robots.txt); nginx.conf/vite dev proxy read GITEA_CONTENTS_API; .env.example; AGENTS.md + specs updated. Rev.7: site identity delivered as Gitea Actions variables (vars. context, public values) instead of secrets; upload-artifact unified to v7 across jobs.
55 lines
1.6 KiB
Nginx Configuration File
55 lines
1.6 KiB
Nginx Configuration File
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
|
|
server_name _;
|
|
|
|
root /usr/share/nginx/html;
|
|
index index.html;
|
|
|
|
# React/Vue/Vite SPA routing
|
|
location / {
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
# Do not aggressively cache index.html.
|
|
# It references the latest hashed JS/CSS files.
|
|
location = /index.html {
|
|
try_files $uri =404;
|
|
|
|
add_header Cache-Control "no-cache, must-revalidate";
|
|
}
|
|
|
|
# Vite-generated assets normally contain content hashes.
|
|
# They can safely be cached for a long time.
|
|
location ~* \.(?:css|js|mjs|map|png|jpg|jpeg|gif|svg|ico|webp|avif|woff|woff2|ttf|otf)$ {
|
|
try_files $uri =404;
|
|
|
|
expires 30d;
|
|
add_header Cache-Control "public, max-age=2592000, immutable";
|
|
}
|
|
|
|
location = /favicon.ico {
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
|
|
location = /robots.txt {
|
|
access_log off;
|
|
log_not_found off;
|
|
}
|
|
|
|
# Content write path (spec-v4 §6.2, spec-v4-deploy-infra D11/D13): Basic-auth
|
|
# at the proxy; ${GITEA_TOKEN} and ${GITEA_CONTENTS_API} are substituted by
|
|
# the image's envsubst template step from the container environment (sourced
|
|
# from the stack's secrets/site_config) — the SPA bundle and the repository
|
|
# never carry the token or the Gitea host.
|
|
location /api/content/ {
|
|
auth_basic "Editor";
|
|
auth_basic_user_file /etc/nginx/htpasswd;
|
|
|
|
proxy_pass ${GITEA_CONTENTS_API};
|
|
proxy_ssl_server_name on;
|
|
proxy_set_header Authorization "token ${GITEA_TOKEN}";
|
|
}
|
|
} |