2024-10-08 22:16:17 +08:00
|
|
|
server {
|
|
|
|
|
listen 80;
|
|
|
|
|
server_name localhost;
|
|
|
|
|
|
|
|
|
|
# 增加客户端请求体大小限制
|
|
|
|
|
client_max_body_size 20M;
|
|
|
|
|
|
|
|
|
|
location / {
|
|
|
|
|
root /usr/share/nginx/html;
|
|
|
|
|
try_files $uri /index.html;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
location /api/ {
|
2026-03-19 11:26:04 +08:00
|
|
|
proxy_pass http://api:5050/api/;
|
2024-10-08 22:16:17 +08:00
|
|
|
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;
|
2026-03-19 11:26:04 +08:00
|
|
|
proxy_set_header Connection '';
|
|
|
|
|
proxy_http_version 1.1;
|
2024-10-08 22:16:17 +08:00
|
|
|
|
2026-03-19 11:26:04 +08:00
|
|
|
# SSE/流式响应支持
|
|
|
|
|
proxy_buffering off;
|
|
|
|
|
proxy_cache off;
|
|
|
|
|
chunked_transfer_encoding on;
|
|
|
|
|
|
|
|
|
|
# 增加超时时间(上传和流式响应)
|
2024-10-08 22:16:17 +08:00
|
|
|
proxy_read_timeout 600;
|
|
|
|
|
proxy_connect_timeout 600;
|
|
|
|
|
proxy_send_timeout 600;
|
|
|
|
|
}
|
|
|
|
|
}
|