5a0aa9ffbb
Deploy Docs / deploy (push) Failing after 47s
- .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)
27 lines
717 B
Nginx Configuration File
27 lines
717 B
Nginx Configuration File
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";
|
|
}
|
|
}
|