2b7efb23ec
## 修复内容 ### 字体优化 - 创建 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 个错误
238 lines
7.9 KiB
Plaintext
238 lines
7.9 KiB
Plaintext
user nginx;
|
|
worker_processes auto;
|
|
error_log /var/log/nginx/error.log warn;
|
|
pid /var/run/nginx.pid;
|
|
|
|
events {
|
|
worker_connections 1024;
|
|
use epoll;
|
|
multi_accept on;
|
|
}
|
|
|
|
http {
|
|
resolver 127.0.0.11 valid=30s ipv6=off;
|
|
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
|
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
|
'$status $body_bytes_sent "$http_referer" '
|
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
|
|
|
access_log /var/log/nginx/access.log main;
|
|
|
|
server_tokens off;
|
|
client_max_body_size 100M;
|
|
|
|
add_header X-Frame-Options "SAMEORIGIN" always;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
|
|
limit_req_zone $binary_remote_addr zone=general:10m rate=100r/s;
|
|
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
keepalive_timeout 65;
|
|
types_hash_max_size 2048;
|
|
|
|
gzip on;
|
|
gzip_disable "msie6";
|
|
gzip_vary on;
|
|
gzip_proxied any;
|
|
gzip_comp_level 6;
|
|
gzip_buffers 16 8k;
|
|
gzip_http_version 1.1;
|
|
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+text text/javascript;
|
|
|
|
upstream gitea_app {
|
|
server gitea:3000;
|
|
}
|
|
|
|
upstream jenkins_app {
|
|
server jenkins:8080;
|
|
}
|
|
|
|
# Novalon 主站 - 静态文件服务
|
|
server {
|
|
listen 80;
|
|
server_name novalon.cn www.novalon.cn;
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://www.novalon.cn$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name novalon.cn www.novalon.cn;
|
|
|
|
ssl_certificate /etc/nginx/ssl/fullchain.pem;
|
|
ssl_certificate_key /etc/nginx/ssl/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
|
|
ssl_prefer_server_ciphers off;
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 1d;
|
|
|
|
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;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
|
|
# 静态文件根目录
|
|
root /var/www/novalon;
|
|
index index.html;
|
|
|
|
# 静态资源长期缓存
|
|
location /_next/static/ {
|
|
expires 1y;
|
|
add_header Cache-Control "public, max-age=31536000, immutable";
|
|
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 ~* \.(ttf|woff|woff2|eot)$ {
|
|
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 /var/www/certbot;
|
|
}
|
|
|
|
# Next.js 静态导出的页面路由
|
|
location / {
|
|
limit_req zone=general burst=20 nodelay;
|
|
try_files $uri $uri.html $uri/ /404.html;
|
|
}
|
|
|
|
# 自定义 404 页面
|
|
error_page 404 /404.html;
|
|
|
|
# 优化文件传输
|
|
sendfile on;
|
|
tcp_nopush on;
|
|
tcp_nodelay on;
|
|
}
|
|
|
|
# Git 服务
|
|
server {
|
|
listen 80;
|
|
server_name git.f.novalon.cn;
|
|
|
|
location /.well-known/acme-challenge/ {
|
|
root /var/www/certbot;
|
|
}
|
|
|
|
location / {
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name git.f.novalon.cn;
|
|
|
|
ssl_certificate /etc/nginx/ssl/git.f.novalon.cn/fullchain.pem;
|
|
ssl_certificate_key /etc/nginx/ssl/git.f.novalon.cn/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
|
|
ssl_prefer_server_ciphers off;
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 1d;
|
|
|
|
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;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
|
|
location / {
|
|
limit_req zone=general burst=20 nodelay;
|
|
proxy_pass http://gitea_app;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
|
|
proxy_hide_header X-Powered-By;
|
|
|
|
proxy_connect_timeout 30s;
|
|
proxy_send_timeout 30s;
|
|
proxy_read_timeout 30s;
|
|
}
|
|
}
|
|
|
|
# CI 服务
|
|
server {
|
|
listen 80;
|
|
server_name ci.f.novalon.cn;
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen 443 ssl http2;
|
|
server_name ci.f.novalon.cn;
|
|
|
|
ssl_certificate /etc/nginx/ssl/ci.f.novalon.cn/fullchain.pem;
|
|
ssl_certificate_key /etc/nginx/ssl/ci.f.novalon.cn/privkey.pem;
|
|
ssl_protocols TLSv1.2 TLSv1.3;
|
|
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305;
|
|
ssl_prefer_server_ciphers off;
|
|
ssl_session_cache shared:SSL:10m;
|
|
ssl_session_timeout 1d;
|
|
|
|
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;
|
|
add_header X-XSS-Protection "1; mode=block" always;
|
|
|
|
location / {
|
|
limit_req zone=general burst=20 nodelay;
|
|
proxy_pass http://jenkins_app;
|
|
proxy_http_version 1.1;
|
|
proxy_set_header Upgrade $http_upgrade;
|
|
proxy_set_header Connection 'upgrade';
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
proxy_set_header X-Forwarded-Proto $scheme;
|
|
proxy_set_header X-Forwarded-Port $server_port;
|
|
|
|
proxy_hide_header X-Powered-By;
|
|
|
|
proxy_connect_timeout 60s;
|
|
proxy_send_timeout 60s;
|
|
proxy_read_timeout 60s;
|
|
|
|
client_max_body_size 100m;
|
|
}
|
|
|
|
access_log /var/log/nginx/jenkins-access.log;
|
|
error_log /var/log/nginx/jenkins-error.log;
|
|
}
|
|
}
|