Apache concurrent connections and bandwidth control in Linux

Source: Internet
Author: User
The stability, security, performance, and low price of Linux + Apache are gaining more and more market share. more and more friends are using Linux + Apache as website servers, while Apache is an http service, it is not easy to control than FTP, especially The stability, security, performance, and low price of Linux Apache are gaining more and more market share. more and more friends are using Linux Apache as website servers. Apache, as an http service, it is not easy to control over FTP, especially when the website provides software/music downloads via http, if each user enables multiple threads without bandwidth restrictions, it will soon reach the maximum number of http connections or cause network congestion, making many normal services of the website unable to run. However, Apache applications have already developed mod_limitipconn and mod_bandwidth modules to control the number of concurrent http connections and the bandwidth that can be applied by users, the following describes how to use RedHat Linux 7.3 Apache 1.3.7.

I. use mod_limitipconn to limit the number of concurrent connections of Apache

Mod_limitipconn can control the number of concurrent connections that each IP address connects to a directory on the server at the same time. it is a very useful module. its official webpage is 0.04 of Apache 1.3.7 and supports Apache 2. x module download, because I have applied Apache 1.3.7, so please apply 2. A friend of Apache of version x went to the official website to observe specific application methods.

Mod_limitipconn for Apache 1.3x provides three installation methods: tar package, rpm installation file, and rpm source file. since the rpm package can only be used in RedHat 7.x, it does not support detection of proxy servers, therefore, we generally apply the installation method of the tar package.

Log on to the server as a administrator, and then run wget javaszxvf mod_limitipconn-0.04.tar.gz on the server to extract the tar package, which is a native mod_limitipconn-0.04 directory under the current directory, and then the cd mod_limitipconn-0.04 enters this directory, the next step is to use apxs to compile mod_limitipconn.c in the directory. In this case, we need to determine the directory where our Apache is installed and find out where the apxs command is.

By running the whereis apxs command, we can determine the path of the apxs command. for example, the path of my apxs command is/usr/sbin/apxs, enter/usr/sbin/apxs-c-I-a mod_limitipconn.c to compile mod_limitipconn.c. this command will take the initiative in your Apache configuration file httpd. in the conf file, copy the native mod_limitipconn.so module to the module directory of Apache. To check whether the command works properly, check the directory of your Apache Module (my directory is/usr/lib/apache) to check whether the mod_limitipconn.so file is contained in the directory, if not, copy the natural files in the mod_limitipconn-0.04 directory here.

Some errors may occur in the httpd. conf command. in my system, it puts LoadModule limitipconn_module modules/mod_limitipconn.so

  
LoadModule python_module modules/mod_python.so
  

And put AddModule mod_limitipconn.c in

  
AddModule mod_python.c
  

The mod_limitipconn module does not run properly. therefore, move the two lines to the corresponding row that does not exist, and confirm that the mod_status module has been loaded, the ExtendedStatus On line is added under mod_status. In this case, the mod_limitipconn module is installed. The next step is to set the number of concurrent connections for a directory.

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.