fe7649ed6e
- feat(deploy): 前端多阶段构建 (vite build + nginx:alpine),移除 Vite 开发模式 - feat(deploy): OpenResty HTTPS 配置 (SSL + HSTS + 安全头) - fix(ws): WebSocket 路由添加 /api 前缀,修正前后端路径不匹配 - security: SSH AutoAddPolicy → WarningPolicy - security: CORS 来源环境变量化 (CORS_ORIGINS) - security: 限流器使用 X-Forwarded-For 真实客户端 IP - perf(db): 数据库连接池配置 (pool_size=20, max_overflow=40) - refactor: 移除硬编码 URL/IP (NTP、域名、微信代理),改为环境变量 - chore: 更新 .env.example 模板,补充新增配置项 - chore: 清理 .reasonix/、scripts/、guide.md 无用文件 - docs: 更新 CLAUDE.md 至 v0.10.0,补充生产架构文档 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
2.1 KiB
Plaintext
55 lines
2.1 KiB
Plaintext
server {
|
||
listen 80;
|
||
listen 443 ssl http2;
|
||
server_name onu.dhdx.fun;
|
||
index index.html;
|
||
proxy_set_header Host $host;
|
||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||
proxy_set_header X-Forwarded-Host $server_name;
|
||
proxy_set_header X-Real-IP $remote_addr;
|
||
proxy_http_version 1.1;
|
||
proxy_set_header Upgrade $http_upgrade;
|
||
proxy_set_header Connection $http_connection;
|
||
access_log /www/sites/onu.dhdx.fun/log/access.log main;
|
||
error_log /www/sites/onu.dhdx.fun/log/error.log;
|
||
|
||
location ^~ /.well-known/acme-challenge {
|
||
allow all;
|
||
root /usr/share/nginx/html;
|
||
}
|
||
|
||
if ($scheme = http) {
|
||
return 301 https://$host$request_uri;
|
||
}
|
||
|
||
ssl_certificate /www/sites/onu.dhdx.fun/ssl/fullchain.pem;
|
||
ssl_certificate_key /www/sites/onu.dhdx.fun/ssl/privkey.pem;
|
||
ssl_protocols TLSv1.3 TLSv1.2 TLSv1.1 TLSv1;
|
||
ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:!aNULL:!eNULL:!EXPORT:!DSS:!DES:!RC4:!3DES:!MD5:!PSK:!KRB5:!SRP:!CAMELLIA:!SEED;
|
||
ssl_prefer_server_ciphers on;
|
||
ssl_session_cache shared:SSL:10m;
|
||
ssl_session_timeout 10m;
|
||
error_page 497 https://$host$request_uri;
|
||
proxy_set_header X-Forwarded-Proto https;
|
||
add_header Strict-Transport-Security "max-age=31536000";
|
||
|
||
# 安全头
|
||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||
add_header X-Content-Type-Options "nosniff" always;
|
||
add_header X-XSS-Protection "1; mode=block" always;
|
||
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
||
|
||
# 前端(生产 nginx 容器,端口 18062)
|
||
location / {
|
||
proxy_pass http://127.0.0.1:18062;
|
||
}
|
||
|
||
# 后端 API(frp 隧道 → 本机后端 /api/ws/dashboard WebSocket)
|
||
location /api/ {
|
||
proxy_pass http://127.0.0.1:18060;
|
||
proxy_read_timeout 3600s;
|
||
proxy_send_timeout 3600s;
|
||
proxy_connect_timeout 60s;
|
||
}
|
||
}
|