v0.1.0: CRM/ERP 系统内测版本 - 安全加固完成

- Docker bridge 网络隔离(8000 端口封死)
- Gunicorn 4 Worker 多进程
- Alembic 数据库迁移基线
- 日志轮转 20m×3
- JWT 密钥 + DB 密码 + CORS 收紧
- 3-2-1 备份链路(NAS + R740-B 冷备)
- 连接池 pool_pre_ping + pool_recycle=3600
This commit is contained in:
hankin
2026-03-16 07:31:37 +00:00
commit 423baff73b
2578 changed files with 824643 additions and 0 deletions
+57
View File
@@ -0,0 +1,57 @@
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
index index.html;
# ---------- 前端静态资源 ----------
location / {
try_files $uri $uri/ /index.html;
# HTML 文件不缓存
add_header Cache-Control "no-store, no-cache, must-revalidate" always;
add_header Pragma "no-cache" always;
}
# ---------- SSE 长连接专用(AI 复盘报告等)----------
location /api/reports/generate {
proxy_pass http://backend:8000/api/reports/generate;
proxy_http_version 1.1;
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 Connection '';
# SSE 必须: 禁用缓冲
proxy_buffering off;
proxy_cache off;
chunked_transfer_encoding on;
# LLM 生成可能需要 5-10 分钟
proxy_read_timeout 600s;
proxy_send_timeout 600s;
}
# ---------- 后端 API 反向代理 ----------
location /api/ {
proxy_pass http://backend:8000/api/;
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_read_timeout 300s;
proxy_send_timeout 120s;
# 文件上传大小限制
client_max_body_size 50m;
}
# ---------- 静态资源缓存(带 hash 的 JS/CSS 长缓存) ----------
location /assets/ {
expires 30d;
add_header Cache-Control "public, immutable";
}
}