|
|
|
|
@ -92,6 +92,21 @@ server {
|
|
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Vite 将这些第三方库输出为带内容哈希的独立文件。文件内容变化时 URL 会变化,
|
|
|
|
|
# 因此可以长期缓存;业务代码不会匹配此规则。
|
|
|
|
|
location ~ ^/assets/(?:element-plus|hiprint|form-create|wangeditor|echarts|cropperjs|vue)-[A-Za-z0-9_-]+\.js$ {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
try_files $uri =404;
|
|
|
|
|
add_header Cache-Control "public, max-age=31536000, immutable" always;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# 项目业务 JS 不使用浏览器缓存,确保每次访问均会检查线上最新版本。
|
|
|
|
|
location ~ ^/assets/.*\.js$ {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
try_files $uri =404;
|
|
|
|
|
add_header Cache-Control "no-store, max-age=0" always;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location / {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
index index.html index.htm;
|
|
|
|
|
|