Files
docs/nginx.conf
T

27 lines
717 B
Nginx Configuration File
Raw Normal View History

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