The process is written as scripts, and the principles are all written in comments. One-click operation is sudo bash xxx. sh.
#! /Bin/bash # cd create the configuration file cd/tmp (cat <EOF <Directory/home/hursing/mylimiteddir/> SetOutputFilter RATE_LIMIT SetEnv rate-limit 30 </Directory> EOF)> ratelimit. conf # The number next to SetEnv rate-limit is the speed limit, measured in KB. Directory indicates which Directory to restrict # create a configuration file. If you manually create a conf file and write the content between two EOF # copy it. All available modules sudo cp ratelimit are placed in the directory of the mod-available Directory. conf/etc/apache2/mod-available/# Put all enabled modules in the directory of "mod-enabled", all of which are soft links, you can use ls-l to see that cd/etc/apache2/mod-enabled # ratelimit is the speed limiting module, and the load suffix file stores the so library path, the conf suffix file configures sudo ln-s for the module .. /mod-available/ratelimit. load. sudo ln-s .. /mod-available/ratelimit. conf. # restart the service to activate sudo service apache2 restart
Some Supplements: Directory labels can be replaced with other tags, such as Location, indicating a specific url. If you do not add a label, it is set globally. You can set multiple tags for different directories. The speed value cannot be decimal.
Ratelimit is added only in version 2.4. Reference http://httpd.apache.org/docs/2.4/mod/mod_ratelimit.html