Add performance optimizations: gzip, cache headers, WOFF2 fonts, lazy loading
All checks were successful
Deploy with Docker Compose / deploy (push) Successful in 38s

Enable gzip compression in nginx, add cache-control headers for static assets,
convert fonts to WOFF2 with font-display swap, preload fonts, add lazy loading
to below-fold images, and remove unused font files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-26 02:29:37 +00:00
parent 7798b54391
commit 474f14b1e5
17 changed files with 64 additions and 8 deletions

View File

@@ -24,6 +24,22 @@ http {
text/javascript mjs;
}
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 256;
gzip_types
text/plain
text/css
text/javascript
application/javascript
application/json
application/xml
image/svg+xml
font/woff2
application/font-woff2;
server {
listen 80;
server_name $DOMAIN www.$DOMAIN;
@@ -61,6 +77,24 @@ http {
ssl_certificate /etc/letsencrypt/live/$DOMAIN/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/$DOMAIN/privkey.pem;
# Vite hashed assets - immutable, cache 1 year
location /assets/ {
expires 1y;
add_header Cache-Control "public, immutable";
}
# Fonts - cache 30 days
location /fonts/ {
expires 30d;
add_header Cache-Control "public";
}
# Images - cache 7 days
location /img/ {
expires 7d;
add_header Cache-Control "public";
}
location /uploads/ {
alias /uploads/;
add_header X-Content-Type-Options nosniff always;

View File

@@ -24,6 +24,22 @@ http {
text/javascript mjs;
}
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 256;
gzip_types
text/plain
text/css
text/javascript
application/javascript
application/json
application/xml
image/svg+xml
font/woff2
application/font-woff2;
server {
listen 80;
server_name $DOMAIN www.$DOMAIN;