NextCloud下载限速
本文最后更新于 543 天前,其中的信息可能已经有所发展或是发生改变。
本文内讨论的是Nginx的配置方法

前言

NextCloud能够创建公开访问的分享链接,感觉挺适合拿来作为下载服务器使用。但是不对下载速度进行限制的话,还是对服务器的小水管带宽有不小的影响,所以就有了本文使用Nginx进行下载限速的教程供以参考。

正文

首先在nginx.conf中的http块中添加以下代码

limit_conn_zone $binary_remote_addr zone=one:10m;

然后再在配置了NextCloud的配置文件的server块中添加以下代码

*请注意修改limit_rate和fastcgi_pass

# download下载限速
    location ~* /s/.*/download {
        limit_conn one 1;
        limit_rate 800k;
        rewrite ^ /index.php$request_uri break;
        fastcgi_split_path_info ^(.+?\.php)(\/.*|)$;
        set $path_info $fastcgi_path_info;
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param HTTPS on;
        # Avoid sending the security headers twice
        fastcgi_param modHeadersAvailable true;
        # Enable pretty urls
        fastcgi_param front_controller_active true;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_intercept_errors on;
        fastcgi_request_buffering off;
    }

最后使用分享链接下载文件就能看到速度限制在 limit_rate 上下了。

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
下一篇