Nginx反向代理下载大文件超时

  1. 需求

     下载超过1G以上文件
    
  2. 服务架构

     浏览器-->Nginx反向代理-->Java应用程序
    
  3. 问题表现

     网络质量良好的情况下浏览器点击下载功能可下载完成并成功打开文件;
     网络质量差时仅能下载到1G左右。
    
  4. 排查

      排查系统性能无异常拨动
      查看Java应用程序日志无异常信息
      Nginx日志在下载未完成时刷新一条“200 OK”日志,error日志出现一条“client timeout”日志
    
  5. 解决

     server上下文中修改proxy_read_timeout 无效
     http上下文中新增 proxy_buffering off; 问题解决
    
  6. 参数解释

     Syntax: 	proxy_buffering on | off;
     Default: 	proxy_buffering on;	
     Context: 	http, server, location
    
     Enables or disables buffering of responses from the proxied server.
     
     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.
     
     Buffering can also be enabled or disabled by passing “yes” or “no” in the “X-Accel-Buffering” response header field. 
     This capability can be disabled using the proxy_ignore_headers directive. 
    
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值