first commit
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
# ============================================================
|
||||
# zt-closet-backend 反向代理配置
|
||||
# 后端监听 127.0.0.1:8080,nginx 对外 80(跳转 443)+ 443(HTTPS)
|
||||
# ============================================================
|
||||
|
||||
# 上传大小限制(衣物图片上传最大 20MB,multipart 边界 + 后端 MaxBytesReader 余量)
|
||||
client_max_body_size 25m;
|
||||
|
||||
# ---------- HTTP 80:强制跳转 HTTPS ----------
|
||||
server {
|
||||
listen 80;
|
||||
server_name your.domain.com;
|
||||
|
||||
# 微信回调、xpay 推送等也一并走 HTTPS
|
||||
location / {
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
}
|
||||
|
||||
# ---------- HTTPS 443:SSL + 反向代理 ----------
|
||||
server {
|
||||
listen 443 ssl;
|
||||
http2 on;
|
||||
server_name your.domain.com;
|
||||
|
||||
# SSL 证书(占位,替换为你的真实路径)
|
||||
ssl_certificate /etc/nginx/ssl/your.domain.com.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/your.domain.com.key;
|
||||
ssl_protocols TLSv1.2 TLSv1.3;
|
||||
ssl_ciphers HIGH:!aNULL:!MD5;
|
||||
ssl_session_cache shared:SSL:10m;
|
||||
ssl_session_timeout 10m;
|
||||
|
||||
# 上传大小限制(覆盖全局,明确写在这里更直观)
|
||||
client_max_body_size 25m;
|
||||
|
||||
# 反向代理到后端
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:8080;
|
||||
|
||||
# 透传真实客户端信息与链路请求 ID
|
||||
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 X-Request-ID $request_id; # 后端 RequestID 中间件会透传
|
||||
|
||||
# 超时:AI 推荐等接口需调大模型,给足余量(后端 WriteTimeout 默认 60s)
|
||||
proxy_connect_timeout 10s;
|
||||
proxy_send_timeout 120s;
|
||||
proxy_read_timeout 120s;
|
||||
|
||||
# 上传大文件建议关闭请求体缓冲,降低延迟与磁盘占用
|
||||
proxy_request_buffering off;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user