Files
ai-platform/nginx.conf
T

30 lines
745 B
Nginx Configuration File

server {
listen 80;
server_name localhost;
root /usr/share/nginx/html;
index index.html;
# gzip 压缩
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml text/javascript image/svg+xml;
gzip_min_length 256;
# SPA 路由 fallback:所有非文件请求回退到 index.html
location / {
try_files $uri $uri/ /index.html;
}
# 静态资源长缓存(Vite 构建产物带 hash)
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# SVG / 图片缓存
location ~* \.(svg|png|jpg|jpeg|gif|ico|webp)$ {
expires 30d;
add_header Cache-Control "public";
}
}