Browse Source

docker: very aggressive CDN, media, css and js file caching on nginx site config

pull/116/head
Zankaria 3 weeks ago
parent
commit
4ca2f5f3a3
  1. 11
      docker/nginx/leftypol.conf

11
docker/nginx/leftypol.conf

@ -21,17 +21,16 @@ server {
# Expire rules for static content
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|webp|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
log_not_found off;
add_header Cache-Control "public";
# Public cache, never changes until max-age expires, max-age of 1 month, can still be served while being
# revalidated or if the server is erroring for 1 day.
add_header Cache-Control "public, immutable, max-age=2592000, stale-while-revalidate=86400, stale-if-error=86400";
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
log_not_found off;
add_header Cache-Control "public";
# Public cache, max-age of 1 year, can still be served while being revalidated or if the server is erroring for 1 day.
add_header Cache-Control "public, max-age=31536000, stale-while-revalidate=86400, stale-if-error=86400";
}
location ~* \.(html)$ {

Loading…
Cancel
Save