From 33753361b060ed4cbb229c6519e001d327c6a518 Mon Sep 17 00:00:00 2001 From: qiaoxinjiu Date: Fri, 8 May 2026 11:22:59 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20simplify=20nginx.conf=20(revert=20cach?= =?UTF-8?q?e=20blocks);=20index.html=20=E6=95=88=E8=83=BD=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- nginx.conf | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/nginx.conf b/nginx.conf index e12a65b..c3ec91f 100644 --- a/nginx.conf +++ b/nginx.conf @@ -1,8 +1,3 @@ -# 前端静态站点:发版后让用户尽快拿到新版本 -# — index.html 禁止缓存(每次拉最新入口,里面的 script/link 会指向新的 hash 资源) -# — /static/ 下 Webpack 带 chunkhash/contenthash 的文件可长期缓存(文件名变 = 新文件) -# 仍需每次发版:重新 build、把新 dist 部署到本 root(或重建/更新镜像并重启容器) - server { listen 80; server_name localhost; @@ -10,19 +5,6 @@ server { root /usr/share/nginx/html; index index.html; - # 入口页:不缓存,避免一直用旧的 index 引用旧 js/css - location = /index.html { - add_header Cache-Control "no-store, no-cache, must-revalidate, max-age=0" always; - add_header Pragma "no-cache" always; - } - - # Webpack 产物:文件名含 hash,可安全长期缓存 - location ^~ /static/ { - expires 1y; - add_header Cache-Control "public, immutable" always; - access_log off; - } - location /it/api/ { proxy_pass http://172.18.0.1:5010; proxy_set_header Host $host;