Debian 11 Bullseye
Sponsored Link

Apache2 : mod_ratelimit の設定2021/09/08

 
[mod_ratelimit] モジュールを有効にして、クライアント向けの帯域制限を設定します。
[1] [mod_ratelimit] は httpd パッケージに含まれているため、パッケージの追加インストールは不要です。
root@www:~#
vi /etc/apache2/conf-available/ratelimit.conf
# 新規作成

# 例として [/download] 配下は [500 KB/sec] に制限

<IfModule mod_ratelimit.c>
    <Location /download>
        SetOutputFilter RATE_LIMIT
        SetEnv rate-limit 500
    </Location>
</IfModule> 

root@www:~#
a2enconf ratelimit

Enabling conf ratelimit.
To activate the new configuration, you need to run:
  systemctl reload apache2

root@www:~#
a2enmod ratelimit

Considering dependency env for ratelimit:
Module env already enabled
Enabling module ratelimit.
To activate the new configuration, you need to run:
  systemctl restart apache2

root@www:~#
systemctl restart apache2

[2] 設定したロケーションにアクセスして動作確認します。
下例は、下が帯域制限したディレクトリからのダウンロード、上が設定なしのディレクトリからのダウンロードです。
関連コンテンツ