-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathdefault.conf
More file actions
197 lines (183 loc) · 5.98 KB
/
default.conf
File metadata and controls
197 lines (183 loc) · 5.98 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
server{
listen 8081;
location / {
root /home/jphouse/front;
index index.html;
try_files $uri $uri/ /index.html;
}
location ^~ /prod-api/ {
rewrite /prod-api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8082;
}
location ^~ /dev-api/ {
rewrite /dev-api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8082;
}
}
server{
listen 8091;
location / {
root /home/mcpx/front;
index index.html;
try_files $uri $uri/ /index.html;
}
location ^~ /prod-api/ {
rewrite /prod-api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:6039;
}
location ^~ /dev-api/ {
rewrite /dev-api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:6039;
}
}
server {
# 启用gzip压缩
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json;
server_name buildingjp.com;
listen 443 ssl;
ssl_certificate /home/cert/buildingjp.com_chain.crt;
ssl_certificate_key /home/cert/buildingjp.com_key.key;
ssl_session_timeout 5m;
# 使用此加密套件。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # 修改protocols。
ssl_prefer_server_ciphers on;
location / {
root /home/jphouse/web;
index index.html;
try_files $uri $uri/ /index.html;
}
location ^~ /user-api/ {
proxy_pass http://127.0.0.1:8082;
}
location ^~ /prod-api/ {
rewrite /prod-api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:8082;
}
}
server {
server_name ai.buildingjp.com;
listen 443 ssl;
ssl_certificate /home/cert/ai.buildingjp.com.pem;
ssl_certificate_key /home/cert/ai.buildingjp.com.key;
ssl_session_timeout 5m;
# 使用此加密套件。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # 修改protocols。
ssl_prefer_server_ciphers on;
location / {
proxy_pass http://127.0.0.1:8088;
#root /home/jphouse/web;
#index index.html;
}
}
server {
client_max_body_size 20m;
server_name mcp-x.com www.mcp-x.com yixiu.ai;
listen 443 ssl;
ssl_certificate /home/mcpx/cert/mcp-x.com.crt;
ssl_certificate_key /home/mcpx/cert/mcp-x.com.key;
ssl_session_timeout 5m;
# 使用此加密套件。
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # 修改protocols。
ssl_prefer_server_ciphers on;
location / {
root /home/mcpx/dist;
index index.html;
try_files $uri $uri/ /index.html;
}
location ^~ /user-api/ {
proxy_pass http://127.0.0.1:6039;
}
# 聊天和代码生成接口 - SSE 流式响应(使用正则表达式匹配多个路径)
location ~ ^/(app/webgen/chat/gen/code|chat/send|chat/send-with-files)$ {
proxy_pass http://127.0.0.1:6039;
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 Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding on;
# 添加响应头,明确告知nginx不要缓冲
add_header X-Accel-Buffering no;
# 禁用缓冲 - 核心配置
proxy_buffering off;
proxy_cache off;
# 设置超时时间
proxy_connect_timeout 600s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
}
# AI视频生成接口 - 增加超时时间(使用正则表达式匹配多个路径)
location ~ ^/prod-api/ai/(video/generate|image/generate|image/edit)$ {
rewrite /prod-api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:6039;
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 Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding on;
# 禁用缓冲,支持 SSE 流式响应
proxy_buffering off;
proxy_cache off;
add_header X-Accel-Buffering no;
# 设置较长的超时时间(视频生成通常耗时较长)
proxy_connect_timeout 1800s;
proxy_send_timeout 1800s;
proxy_read_timeout 1800s;
# 增加客户端超时时间
client_max_body_size 100M;
client_body_timeout 1800s;
}
location ^~ /prod-api/profile/upload/ {
alias /home/mcpx/upload/upload/; # 注意末尾斜杠
autoindex off;
access_log off;
add_header Cache-Control "public, max-age=31536000";
try_files $uri =404;
# 如需明确 webp 类型(一般已内置):types { image/webp webp; }
}
# 通用 prod-api 代理(使用普通前缀匹配,让正则 location 优先)
location /prod-api/ {
rewrite /prod-api/(.*)$ /$1 break;
proxy_pass http://127.0.0.1:6039;
}
location /download/ {
alias /home/mcpx/dist/download/;
autoindex on;
}
location ^~ /dist/ {
# 改成你的实际部署目录(注意末尾有斜杠)
alias /opt/tmp/code_deploy/;
index index.html;
autoindex off;
# 优先命中文件或目录,否则 404
try_files $uri $uri/ =404;
}
}
server {
listen 80;
server_name ai.buildingjp.com;
location / {
proxy_pass http://127.0.0.1:8088;
}
}
server {
listen 80;
server_name mcp-x.com www.mcp-x.com yixiu.ai;
location / {
return 301 https://www.mcp-x.com$request_uri;
}
}
server {
listen 80;
server_name buildingjp.com www.buildingjp.com mansion-market.cn mansion-market.com.cn;
location / {
return 301 https://buildingjp.com;
}
}