Ubuntu configuration apache2.4 speed limit function

  

process is written as a script, the principle is written in the comments, everyone knows. One-click operation is sudo bash xxx.sh

#!/bin/bash#cd to the temporary directory to 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 following SetEnv rate-limit is the speed limit, in KB. Directory indicates which directory to restrict #Create a configuration file, manually create a conf file, and write the content between the two EOFs #copy the past. The mods-available directory places all available modules sudo cp ratelimit.conf /etc/apache2/mods-available/#mods-enabled directory to place all enabled modules, all soft links, can be seen with ls -l cd /etc /apache2/mods-enabled#ratelimit is the speed limit module, the load suffix file stores the path of the so library, and the conf suffix file is for the module configuration sudo ln -s ../mods-available/ratelimit.load .sudo ln -s . ./mods-available/ratelimit.conf .# Restart the service to take effect sudo service apache2 restart

Some additions: The Directory tag can be replaced with something else, such as Location indicating a specific url. Unlabeling is a global setting. There can be multiple tags to set up different directories. The speed value cannot be a decimal.

ratelimit was added in version 2.4. See http://httpd.apache.org/docs/2.4/mod/mod_ratelimit.html

Copyright © Windows knowledge All Rights Reserved