Nginx的流式响应配置详解
现在大模型场景繁多,项目中涉及nginx转发大模型的流式数据时,需配置nginx的转发策略:
location /streaming {
proxy_pass http://backend_server;
proxy_cache off; # 关闭缓存
proxy_buffering off; # 关闭代理缓冲
chunked_transfer_encoding on; # 开启分块传输编码
tcp_nopush on; # 开启TCP NOPUSH选项,禁止Nagle算法
tcp_nodelay on; # 开启TCP NODELAY选项,禁止延迟ACK算法
keepalive_timeout 300; # 设定keep-alive超时时间为300秒
}
原文地址:点击跳转