From f18f20d12b6c07e97fdd0ae1bc2aaf6ce4cb9225 Mon Sep 17 00:00:00 2001 From: SouthFox Date: Fri, 8 Sep 2023 22:06:35 +0800 Subject: [PATCH] [chore] nginx cache css and js files --- dist/nginx.conf | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dist/nginx.conf b/dist/nginx.conf index bc4f105..122c188 100644 --- a/dist/nginx.conf +++ b/dist/nginx.conf @@ -3,6 +3,16 @@ proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive= server { server_name {SERVER}; + location ~* \.(ico|css|js)$ { + proxy_pass http://127.0.0.1:3000; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + expires 1d; + access_log off; + add_header Pragma public; + add_header Cache-Control "public, max-age=86400"; + } + location / { proxy_pass http://127.0.0.1:3000; proxy_set_header Host $host; @@ -11,7 +21,7 @@ server { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_buffering on; proxy_cache STATIC; - proxy_cache_valid 200 1d; + proxy_cache_valid 200 6h; add_header X-Cached $upstream_cache_status; add_header 'Access-Control-Allow-Origin' '*'; }