(Reproduced) Apache concurrent connections and bandwidth control under Linux

xiaoxiao2021-03-06  42

LINUX Apache concurrent number and bandwidth control

Summary

Linux Apache's stability, security and performance, and low prices are winning more and more market share, more and more friends using Linux Apache as a website server, and Apache as an HTTP service, compared to FTP is always not easy to control, especially when the website provides software / music downloads in HTTP, Many normal services that make the site cannot run. However, Apache's users have already developed two modules of MOD_LIMITIPCONN and MOD_BANDWIDTH to control HTTP's concurrent connections and bandwidths that users can use. The following will be used in Redhat Linux 7.3 Apache 1.3.7. . (2004-07-26 23:11:02)

By lanf, source: http://tech.pcicp.com/network/server/2003/08/12/1076653255d2820.html

Author: his life smile Linux stability, security and performance of Apache and low prices are gaining more and more market share, using Linux Apache Web server to make more and more friends, and Apache as an http Service, compared to FTP is always not easy to control, especially when the website provides software / music downloads in HTTP, if each user opens multiple threads, there is no bandwidth limit, will soon reach the maximum number of HTTPs or Causes network stuffing, making many normal services for the website unable to run. However, Apache's users have already developed two modules of MOD_LIMITIPCONN and MOD_BANDWIDTH to control HTTP's concurrent connections and bandwidths that users can use. The following will be used in Redhat Linux 7.3 Apache 1.3.7. . First, using mod_limitipconn limit Apache's concurrent connection MOD_LIMITIPCONN can control each IP address to connect to the server's concurrent connection, is a very useful module, its official web page is http://dominia.org/djaobi ketconn .html, the latest version is 0.04 of for Apache 1.3.7, and also supports Apache 2.x module download, because I use Apache 1.3.7 version, please use the 2.x version Apache friend to the official website Specific use method. MOD_LIMITIPCONN for Apache 1.3X provides three installation methods, which are TAR packets, RPM installation files, and RPM source files. Since the RPM package can only be used in the Redhat 7.x version, and we do not support the detection proxy server, so we generally use tar. Package installation method. Log in to the server in the administrator, then run wget http://dominia.org/djaobin/mod_limitipconn-0.tar.tar.gz on the server to download the mod_limitipconn's TAR package to the server, then run TAR ZXVF mod_limitipConn-0.04 .tar.gz The TAR is compressed and generates the mod_limitipconn-0.04 directory in the current directory, and then CD MOD_LIMITIPCONN-0.04 enters this directory, the next step is to compile Mod_LimitipConn.c in the directory using APXS. At this time, we need to determine your Apache installed in that directory and find where the apxs command is placed. By command whereis apxs, we can determine the path to the apxs command, such as / usr / sbin / apxs in my apxs command, ed_limitipconn.c compile MOD_LIMITIPCONN.C This command will automatically add the required information in your Apache's configuration file httpd.conf, and copy the generated mod_limitipconn.so module to the Apache module directory. However, in order to confirm whether this command is working properly, first check your Apache module directory (my / usr / lib / apache), see if the internal mod_limitipconn.so file, no, please use the files generated in the MOD_LIMITIPCONN-0.04 directory Copy to here.

Command automatically generated httpd.conf just may be some errors in my system, it will LoadModule limitipconn_module modules / mod_limitipconn.so placed LoadModule python_module modules / mod_python.so between, and will AddModule MOD_LIMITIPCONN.C is placed between addmodule mod_python.c , directly caused the mod_limitipconn module to run normally, so move the two lines to the corresponding corresponding to In the line, then confirm that the Mod_Status module has been loaded and adds the ExtendedStatus on the mod_status. At this time, our Mod_LimitipConn module is complete, the next step is to set the number of concurrent connections to a directory. MOD_LIMITIPCONN can perform different restrictions on the global and virtual hosts, which are the directory restricted by #, which means each IP restricted by the host's root directory MaxConnPerip 3 # The number of concurrent connections is 3 noiplimit image / * # The picture does not do IP limit # limited to the directory of the host / MP3 directory MAXConnPerip 1 # concurrently each IP The connection number is 1 Onlyiplimit Audio / MPEG Video # This limit is only for files and , we can change the directory and concurrent connection to the local control and MaxConnPerip. number. Finally, just restart the Apache service, the limit of concurrent connections can take effect. Second, using mod_bandwidth Control Apache's bandwidth Apache 1.3.7 actually has MOD_BANDWIDTH support, just without this module SO file, what we do is to download MOD_BANDWIDTH's source files to compile, and make corresponding settings for Mod_BANDWIDTH. Before downloading, please confirm your Apache configuration file httpd.conf if it contains LoadModule bandwidth_module modules / mod_bandwidth.so and AddModule mod_bandwidth.c If not, please Plus loadingModule Bandwidth_Module Modules / Mod_BANDWIDTH.SO AddModule MOD_BANDWIDTH.C and the two lines must be added to the forefront of the corresponding area, so that this module operates at the lowest priority.

转载请注明原文地址:https://www.9cbs.com/read-58754.html

New Post(0)