[chore] nginx cache css and js files

This commit is contained in:
SouthFox 2023-09-08 22:06:35 +08:00
parent 3ff10f0e8b
commit f18f20d12b

12
dist/nginx.conf vendored
View file

@ -3,6 +3,16 @@ proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=STATIC:10m inactive=
server { server {
server_name {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 / { location / {
proxy_pass http://127.0.0.1:3000; proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host; proxy_set_header Host $host;
@ -11,7 +21,7 @@ server {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_buffering on; proxy_buffering on;
proxy_cache STATIC; proxy_cache STATIC;
proxy_cache_valid 200 1d; proxy_cache_valid 200 6h;
add_header X-Cached $upstream_cache_status; add_header X-Cached $upstream_cache_status;
add_header 'Access-Control-Allow-Origin' '*'; add_header 'Access-Control-Allow-Origin' '*';
} }