From 5e5193fddb12518d69f939964fc508c0face9127 Mon Sep 17 00:00:00 2001 From: hyang Date: Sun, 10 Sep 2023 16:01:14 -0700 Subject: Improve page quality --- nginx-entrypoint.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'nginx-entrypoint.sh') diff --git a/nginx-entrypoint.sh b/nginx-entrypoint.sh index b7fadba..8d19f8e 100755 --- a/nginx-entrypoint.sh +++ b/nginx-entrypoint.sh @@ -84,6 +84,25 @@ server { # Default index file for this virtual host index index.html index.htm; + location ~* \.(?:jpg|jpeg|gif|png|ico|svg|webp)$ { + expires 1M; + access_log off; + # max-age must be in seconds + add_header Cache-Control "max-age=2629746, public"; + } + + location ~* \.(?:css|js)$ { + expires 1y; + access_log off; + add_header Cache-Control "max-age=31556952, public"; + } + + gzip on; + gzip_min_length 1100; + gzip_buffers 4 32k; + gzip_types text/plain application/x-javascript text/xml text/css; + gzip_vary on; + # Logging configuration access_log /var/log/nginx/hugo_pub_access.log; error_log /var/log/nginx/hugo_pub_error.log; -- cgit v1.2.3