Files
hoelee-profile/deploy/nginx/me.hoelee.com.conf
T
hoelee 5727ab0c8a perf(serve): static boot shell, gzip and immutable caching for the hashed assets
Measured against the live host:
- the shell shipped no Content-Encoding, so every visit moved 139 KB of JS raw
  -> gzip on (level 5, vary, text/js/css/json/svg/woff2): 139,433 B -> 49,835 B
- /static/* is content-hashed but had no cache header -> max-age=31536000, immutable;
  index.html is no-cache so a deploy lands immediately
- try_files fell through to a non-existent index.php -> SPA fallback to index.html
- index.html now carries a boot shell (name, role, 'rendering the resume') so a cold
  load shows the identity instead of an empty dark rectangle while the JS types in
- deploy/nginx/me.hoelee.com.conf is the versioned copy of the live config; README
  documents the Portainer archive deploy path, the Tor mirror and the inode pitfall
2026-11-13 22:40:22 +08:00

63 lines
1.5 KiB
Plaintext

server {
listen 80;
server_name me.hoelee.com;
root /var/www/html;
index index.html index.htm;
client_max_body_size 100M;
server_tokens off;
# The site is a static Vue SPA: one HTML shell + hashed static/ assets.
# No PHP is served (the php-fpm sidecar is a leftover of the template).
# 139 KB of JS per visit went out uncompressed before this: enable gzip.
gzip on;
gzip_vary on;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_types
text/plain
text/css
text/javascript
application/javascript
application/json
application/manifest+json
image/svg+xml
font/woff2;
# SPA fallback: unknown paths return the shell instead of hitting a missing index.php.
location / {
try_files $uri $uri/ /index.html;
}
# Filenames are content-hashed by Vite, so they can be cached forever.
location /static/ {
add_header Cache-Control "public, max-age=31536000, immutable";
access_log off;
try_files $uri =404;
}
# The shell and the icons must be revalidated so a deploy is visible immediately.
location = /index.html {
add_header Cache-Control "no-cache";
}
location = /robots.txt {
add_header Cache-Control "public, max-age=3600";
}
location = /favicon.ico {
add_header Cache-Control "public, max-age=604800";
access_log off;
}
location ~ /\.ht {
deny all;
}
}