-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathnginx.conf
More file actions
68 lines (56 loc) · 2.14 KB
/
nginx.conf
File metadata and controls
68 lines (56 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# =================================================================
# Xinghuo-2api - 终极粘性会话与性能版 Nginx 配置
# 核心: 绝对信任后端,零干预,极致吞吐,并采用最健壮的会话保持策略
# =================================================================
# --- 全局性能设置 ---
worker_processes auto;
worker_rlimit_nofile 102400;
# --- 事件模型优化 ---
events {
worker_connections 102400;
use epoll;
multi_accept on;
}
# --- HTTP 核心配置 ---
http {
# --- 基础性能优化 ---
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 15s;
client_body_timeout 10s;
client_header_timeout 10s;
server_tokens off;
access_log off;
# --- 上游服务器组 (我们的 AI 工人) ---
upstream xinghuo_backend {
# 关键修正 🚀: 使用 Cookie 实现“终极粘性会话”
# 讯飞星火使用 Cookie 进行认证和会话跟踪。
# 使用 $http_cookie 作为哈希键,确保来自同一用户的所有请求
# (携带相同Cookie) 都被转发到同一个后端 FastAPI 实例,
# 这对于维护对话状态至关重要。
hash $http_cookie consistent;
# 性能策略: 开启与工人的“VIP连接池”,实现极致连接复用
keepalive 128;
# 信任策略: 移除所有健康检查和熔断机制
server xinghuo-local:8082;
}
# --- 主服务器配置 (API 网关) ---
server {
listen 80;
location / {
# 性能策略: 移除所有请求限流
proxy_pass http://xinghuo_backend;
# --- 流式传输终极优化 ---
proxy_buffering off;
proxy_cache off;
# --- 协议与头信息设置 ---
proxy_http_version 1.1;
proxy_set_header Connection "";
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;
}
}
}