Files
novalon-website/nginx-static.conf
T
张翔 2b7efb23ec fix: 修复字体加载警告和Logo图片宽高比问题
## 修复内容

### 字体优化
- 创建 AoyagiReisho-subset.ttf 子集字体,仅包含"睿新致远"4个字符
- 文件大小从 4.4MB 减小到 5KB(99.9% 减少)
- 修复 vmtx 表解析错误导致的 48 个控制台警告

### Logo 图片修复
- 修复 Logo SVG 宽高比问题(原始 480x120,4:1 比例)
- Header: width=128 height=32
- Footer: width=192 height=48
- 消除 Next.js Image 组件警告

### 其他优化
- 简化字体加载逻辑
- 更新部署配置

## 测试结果
- 32 个回归测试全部通过
- 0 个控制台警告
- 0 个错误
2026-04-22 16:00:49 +08:00

101 lines
3.1 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Novalon 静态站点 Nginx 配置
# 用法:替换现有 nginx.conf,然后 nginx -t && nginx -s reload
server {
listen 80;
server_name novalon.cn www.novalon.cn;
return 301 https://www.novalon.cn$request_uri;
}
server {
listen 443 ssl http2;
server_name novalon.cn www.novalon.cn;
# SSL 证书配置
ssl_certificate /etc/nginx/ssl/fullchain.pem;
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
# 静态文件根目录
root /usr/share/nginx/html;
index index.html;
# Gzip 压缩
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_min_length 256;
gzip_types
text/plain
text/css
text/xml
text/javascript
application/json
application/javascript
application/xml
application/rss+xml
image/svg+xml;
# 安全头
add_header X-DNS-Prefetch-Control "on" always;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Referrer-Policy "origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
# 静态资源长期缓存(带内容哈希的文件)
location /_next/static/ {
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
# 安全头需要重新添加(location 块会覆盖 server 级别的 add_header
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
try_files $uri =404;
}
# 字体文件缓存
location /fonts/ {
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Access-Control-Allow-Origin "*";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
try_files $uri =404;
}
# 图片文件缓存
location ~* \.(svg|jpg|jpeg|png|gif|webp|avif|ico)$ {
expires 1y;
add_header Cache-Control "public, max-age=31536000, immutable";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" always;
try_files $uri =404;
}
# Let's Encrypt ACME challenge
location /.well-known/acme-challenge/ {
root /usr/share/nginx/html;
try_files $uri =404;
}
# Next.js 静态导出的页面路由
# /about -> /about.html 或 /about/index.html
location / {
try_files $uri $uri.html $uri/ /404.html;
}
# 自定义 404 页面
error_page 404 /404.html;
# 优化文件传输
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
}