回答
收藏
分享
举报
NGINX proxy_buffering 指令
提问于2021-01-18 13:30

浏览 747

请问,如果启用了proxy_buffering, NGINX从上游服务器读取数据时的行为是下面哪一种?


1.把所有的上游数据都先读到buffer里面,buffer不够就使用磁盘临时文件,等读完以后再传给客户端。 

2.读一部分上游响应先放到buffering里面,然后立刻发送给客户端。依次循环直到读完所有的上游返回的内容?

已修改于2023-03-16 02:24



写下您的回答
发表回答
全部回答(1)

按点赞数排序

按时间排序

第1种。参考官方文档:

“When buffering is enabled, nginx receives a response from the proxied server as soon as possible, saving it into the buffers set by the proxy_buffer_size and proxy_buffers directives. If the whole response does not fit into memory, a part of it can be saved to a temporary file on the disk. Writing to temporary files is controlled by the proxy_max_temp_file_size and proxy_temp_file_write_size directives.

When buffering is disabled, the response is passed to a client synchronously, immediately as it is received. nginx will not try to read the whole response from the proxied server. The maximum size of the data that nginx can receive from the server at a time is set by the proxy_buffer_size directive.”

赞同

2

回复举报

回答于2021-01-18 13:58



回复陶辉
回复
Rockets回复了

多谢!

0

回复举报

回答于2021-01-18 12:09



回复Rockets
回复
提问者
Rockets
这家伙很懒还未留下介绍~
0
文章
10
问答
1
粉丝
相关问答

这是一些监控的截图

点赞 0
浏览 839


location / {
proxy_pass http://inter-router;
proxy_set_header Host ***;
proxy_http_version 1.1;
}
location ^~ /websocket/ {
proxy_pass http://inter-router/websocket/;
proxy_set_header Host ***;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 600s;
}

不要把websocket 配置放到通配符里面,那样就全部都是了,只对websocket部分,这样用,示例如上

点赞 0
浏览 789