一、作用:
1、mod_ratelimit提供了一個(gè)過濾器叫做RATE_LIMIT,用來限制客戶帶寬。
2、限制應(yīng)用在每個(gè)HTTP給客戶傳輸回應(yīng)數(shù)據(jù)時(shí),而不是在IP層面;
3、如果同一個(gè)IP多個(gè)HTTP連接,只針對每個(gè)HTTP進(jìn)行限制;
二、配置:
1、在apache的配置文件httpd.conf中開啟 mod_ratelimit.so 模塊;
2、在apche的網(wǎng)站配置文件中添加(標(biāo)記為新增的三行)一下代碼:
<VirtualHost *:80>
DocumentRoot "C:/www/tp6/public"
ServerName myiiiwebsite.com
ServerAlias
FcgidInitialEnv PHPRC "C:/phpstudy_pro/Extensions/php/php7.3.4nts_p"
AddHandler fcgid-script .php
FcgidWrapper "C:/phpstudy_pro/Extensions/php/php7.3.4nts_p/php-cgi.exe" .php
SetOutputFilter RATE_LIMIT //限制客戶端帶寬(新增)
SetEnv rate-limit 500 //限速500KiB(新增)
SetEnv rate-initial-burst 512 //初始burst速率(新增)
<Directory "C:/www/tp6/public">
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
DirectoryIndex index.php index.html error/index.html
</Directory>
</VirtualHost>