From c49ff2a6fceea7aa1b2a5a37201d44b2af900c11 Mon Sep 17 00:00:00 2001 From: ittoview Date: Fri, 22 May 2026 08:36:51 +0100 Subject: [PATCH] chore: cache learning map images --- nginx.conf | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/nginx.conf b/nginx.conf index 76aa277..6c9ffa8 100644 --- a/nginx.conf +++ b/nginx.conf @@ -26,7 +26,14 @@ server { add_header Cache-Control "no-store"; } - # 一图流图片目录,由 Docker 挂载提供,支持运行时新增图片 + # 一图流图片文件缓存 30 天;新增图片建议使用新文件名,避免同名覆盖缓存未刷新 + location ~* ^/learning-images/.+\.(png|jpg|jpeg|webp|gif|avif)$ { + root /usr/share/nginx/html; + expires 30d; + add_header Cache-Control "public, max-age=2592000"; + } + + # 一图流图片目录,由 Docker 挂载提供;目录列表不缓存,保证新增图片能及时被页面发现 location /learning-images/ { alias /usr/share/nginx/html/learning-images/; autoindex on;