- .gitea/workflows/deploy.yaml: Actions pipeline - Dockerfile: nginx:alpine serving site/ - nginx.conf: SPA routing + gzip + cache - .dockerignore: exclude source files - .gitignore: exclude site/ (built in CI)
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
server {
|
||||
listen 80;
|
||||
server_name _;
|
||||
|
||||
root /usr/share/nginx/html;
|
||||
index index.html;
|
||||
|
||||
# MkDocs Material 使用 SPA 风格路由,需要回退到 index.html
|
||||
location / {
|
||||
try_files $uri $uri/ $uri.html /index.html;
|
||||
}
|
||||
|
||||
# 404 也回退到 index.html(搜索功能需要)
|
||||
error_page 404 /404.html;
|
||||
|
||||
# Gzip 压缩
|
||||
gzip on;
|
||||
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
|
||||
gzip_min_length 256;
|
||||
|
||||
# 静态资源缓存
|
||||
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 7d;
|
||||
add_header Cache-Control "public, no-transform";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user