All checks were successful
CI / build (push) Successful in 2m6s
将图标资源迁移到 src/assets 并通过构建产物 hash 管理缓存,移除 public 目录旧图标引用;新增 Nginx 配置,设置 index.html 协商缓存与 /assets 长缓存策略。 Made-with: Cursor
33 lines
853 B
Nginx Configuration File
33 lines
853 B
Nginx Configuration File
server {
|
||
listen 80;
|
||
server_name _;
|
||
|
||
root /usr/share/nginx/html;
|
||
index index.html;
|
||
|
||
# Vite build 产物:文件名带 hash,可长期缓存
|
||
location /assets/ {
|
||
expires 1y;
|
||
add_header Cache-Control "public, max-age=31536000, immutable";
|
||
try_files $uri =404;
|
||
}
|
||
|
||
# 单独图标按中等缓存(如果后续也迁到 /assets,可删除)
|
||
location ~* ^/(favicon\.ico|favicon\.png|apple-touch-icon\.png)$ {
|
||
expires 7d;
|
||
add_header Cache-Control "public, max-age=604800";
|
||
try_files $uri =404;
|
||
}
|
||
|
||
# 入口 HTML 每次协商缓存,确保能拿到最新资源清单
|
||
location = /index.html {
|
||
add_header Cache-Control "no-cache";
|
||
try_files $uri =404;
|
||
}
|
||
|
||
# SPA 路由回退
|
||
location / {
|
||
try_files $uri $uri/ /index.html;
|
||
}
|
||
}
|