-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathw8t.conf
57 lines (45 loc) · 1.92 KB
/
w8t.conf
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
server {
listen 80;
root /app;
index index.html index.htm;
location / {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
try_files $uri $uri/ /index.html;
}
location /api {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS';
add_header Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
resolver 8.8.8.8;
# 优化超时设置,避免因请求处理时间过长导致超时
proxy_connect_timeout 300;
proxy_read_timeout 300;
proxy_send_timeout 300;
# 优化缓冲区设置,避免大请求体导致缓冲区不足
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
# 关闭代理请求缓冲,确保大请求体直接传递到后端
proxy_request_buffering off;
# 配置SSL和代理相关参数
proxy_ssl_server_name on;
proxy_ssl_protocols TLSv1.2;
proxy_pass http://w8t-service:9001;
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 Content-Type "application/json";
proxy_set_body $request_body;
proxy_pass_request_headers on;
}
# 错误页面配置
error_page 500 502 503 504 /500.html;
# 全局请求体大小限制
client_max_body_size 2050m;
client_body_buffer_size 1024k;
# 保持连接超时时间
keepalive_timeout 10;
}