Ubuntu Server configuration apache2.4 speed limit function shell script sharing _linux Shell

Source: Internet
Author: User

The process is written in a script, the principles are written in the comments, you understand. One-click operation is sudo bash xxx.sh

Copy Code code as follows:

#!/bin/bash
#cd到临时目录创建配置文件
Cd/tmp
(Cat <<eof
<Directory/home/hursing/mylimiteddir/>
Setoutputfilter Rate_limit
Setenv Rate-limit 30
</Directory>
Eof
) > Ratelimit.conf
# The number above setenv Rate-limit is the speed limit, in kilobytes. Directory represents which directories are restricted
#创建配置文件, manual operation is to create a conf file, and write the contents between two EOF
#复制过去. Mods-available directory to place all available modules
sudo cp ratelimit.conf/etc/apache2/mods-available/
#mods-enabled directory to place all enabled modules, full of soft links, you can use Ls-l to see
Cd/etc/apache2/mods-enabled
#ratelimit就是限速模块, the load suffix file holds the path to the so library, and the Conf suffix file is configured for the module
sudo ln-s. /mods-available/ratelimit.load.
sudo ln-s. /mods-available/ratelimit.conf.
#重启服务来生效
sudo service apache2 restart

Some additions: Directory tags can be replaced by other, such as location represents a specific URL. No tagging is the global setting. There are multiple labels that can be set for different directories. The speed value cannot be decimal.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.