summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhyang <hyang@hyang.xyz>2023-09-10 16:01:14 -0700
committerhyang <hyang@hyang.xyz>2023-09-10 16:01:14 -0700
commit5e5193fddb12518d69f939964fc508c0face9127 (patch)
treec7811bb0edde53ba73adc41b863692b4d65a2da5
parent66cc87ca28f7325f5df2fd264127a3f5217b304c (diff)
Improve page quality
-rwxr-xr-xnginx-entrypoint.sh19
1 files changed, 19 insertions, 0 deletions
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;