diff --git a/nginx.conf b/nginx.conf index e40b2b9a..36a909e8 100644 --- a/nginx.conf +++ b/nginx.conf @@ -34,10 +34,16 @@ http { try_files $uri $uri/ /index.html; } + location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ { + # 静态资源 + expires 1y; + add_header Cache-Control "public, immutable"; + } + location /assets { # 静态资源 - expires 7d; - add_header Cache-Control "public"; + expires 1y; + add_header Cache-Control "public, immutable"; root /public; }