【问题标题】:Nginx limit_rate not applied to proxy_passNginx limit_rate 未应用于 proxy_pass
【发布时间】:2023-03-08 19:07:01
【问题描述】:

limit_rate 不适用于 proxy_pass 有什么具体原因吗?在 nginx 中有以下配置块,我仍然可以以 ~4MB/s 的速度下载代理文件:

location ~ ^/proxy? {
    resolver 8.8.8.8;
    set $limit_rate  50k;
    limit_rate       50k;
    proxy_limit_rate 50k;
    proxy_buffering off;
    proxy_buffer_size 15m;
    proxy_pass_request_body off;
    proxy_read_timeout 20s;
    proxy_pass  $arg_fwd;
}

系统是带有 Nginx 1.10.1 的 Debian 8。除了 apt 中默认打包的模块外,没有安装额外的模块。

【问题讨论】:

    标签: nginx debian


    【解决方案1】:

    proxy_buffering off; 和速率限制是互斥的。您应该启用缓冲以使用限制速率功能。

    【讨论】:

    • 有关于这个的文档吗?
    • okwap 这很自然。限速就像在河上建大坝。拥有水坝总是意味着拥有一个水库,可以将水储存一段时间。
    • 完美!谢谢
    猜你喜欢
    • 2015-01-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-22
    • 1970-01-01
    • 2011-07-12
    相关资源
    最近更新 更多