From 04971c38247dc2b6b8e428e0183e4a0c2f52304b Mon Sep 17 00:00:00 2001 From: ChengLei Shao Date: Fri, 3 Mar 2023 13:10:47 +0800 Subject: [PATCH] fix: nginx cache (#1523) --- docker/nocobase/nocobase.conf | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docker/nocobase/nocobase.conf b/docker/nocobase/nocobase.conf index 0279113cfc..f1faae0b60 100644 --- a/docker/nocobase/nocobase.conf +++ b/docker/nocobase/nocobase.conf @@ -6,10 +6,18 @@ server { client_max_body_size 20M; gzip on; - gzip_vary on; - gzip_min_length 1024; - gzip_proxied expired no-cache no-store private auth; - gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/javascript application/xml; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + # 不缓存 HTML 文件 + location ~ \.html$ { + expires -1; + } + + # 缓存 JavaScript 和 CSS 文件 + location ~* \.(js|css)$ { + expires 1d; + add_header Cache-Control "public"; + } location /storage/uploads/ { alias /app/nocobase/storage/uploads/;