From 699cbbcc1616f2161877b5319c979b9144db7e08 Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Thu, 24 Mar 2022 22:14:12 +0200 Subject: [PATCH] Add cache header for main website static resources --- docker/korhonen.cc/nginx.conf | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/docker/korhonen.cc/nginx.conf b/docker/korhonen.cc/nginx.conf index 4bda4c8..d98043e 100644 --- a/docker/korhonen.cc/nginx.conf +++ b/docker/korhonen.cc/nginx.conf @@ -3,10 +3,16 @@ server { listen [::]:80; server_name localhost; - location / { - root /korhonen.cc; - index index.html; - } + location / { + root /korhonen.cc; + index index.html; + + location ~* \.(?:css|js|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ { + expires 1M; + access_log off; + add_header Cache-Control "public"; + } + } # Use hugo 404 page error_page 404 /404.html;