plugai_updsrv/nginx/cradle_all.conf

128 lines
3.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

upstream api {
server 127.0.0.1:3008;
keepalive 64;
}
upstream apiv1 {
server 127.0.0.1:8083;
keepalive 64;
}
upstream chatws {
server 127.0.0.1:8083;
keepalive 64;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
client_max_body_size 100M;
location / {
proxy_redirect off;
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 Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://api;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location /pics/ {
alias /var/www/pics/;
}
location ^~/api/chat {
proxy_pass http://api;
proxy_ssl_server_name on;
proxy_set_header Host api.jellyai.xyz;
proxy_set_header Connection '';
proxy_http_version 1.1;
chunked_transfer_encoding off;
proxy_buffering off;
proxy_cache off;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ^~/api/v1 {
# ↓↓↓ 请求限速与超时控制(当前已禁用) ↓↓↓
# limit_req zone=req_limit_per_ip burst=20 nodelay;
# 启用限流,每个 IP 每秒最多 10 个请求(需在 http{} 中定义 zone
# burst=20允许瞬时爆发 20 个请求
# nodelay超出速率直接返回 429不排队
# proxy_connect_timeout 3s;
# 与后端服务器建立连接的超时时间(连接超时会返回 504
# proxy_send_timeout 60s;
# 向后端发送完整请求的超时时间(请求体太大/后端卡顿会触发)
# proxy_read_timeout 60s;
# 等待后端返回响应的最大时间(响应慢会触发 504
# send_timeout 60s;
# 向客户端发送响应的超时时间(客户端卡顿可能触发)
# ↑↑↑ 请求限速与超时控制(当前已禁用) ↑↑↑
proxy_redirect off;
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 Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://apiv1;
}
location ^~/api {
proxy_redirect off;
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 Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://api;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location ^~ /api/v1/deploy/ws/ {
proxy_redirect off;
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 Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_set_header Connection "";
proxy_http_version 1.1;
proxy_pass http://chatws;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}