Use mod

xiaoxiao2021-03-05  34

Use mod_limitipconn.c to limit Apache's concurrent number

Linux Technology Starters 2002-12-12

Download MOD_LIMITIPCONN.C

TAR.GZ I386 RPM (Proxy Client Detection Feature Not Enabled) Source RPM

I am using the TAR package that is mod_limitipconn-0.04.tar.gz, (This module can already support Apache2) execute on the server

# wget http://dominia.org/djao/limit/mod_limitipconn-0.04.tar.gz Download to Local

Then perform the following command to compile the installation. My apache is located in / usr / local / apache directory

unzip:

[Root @ ns chenlf] # tar zxvf mod_limitipconn-0.04.tar.gz mod_limitipconn-0.04 / mod_limitipconn-0.04 / Makefilemod_limitipconn-0.04 / READMEmod_limitipconn-0.04 / apachesrc.diffmod_limitipconn-0.04 / mod_limitipconn.cmod_limitipconn-0.04 / ChangeLog

Compilation installation:

[Root @ ns chenlf] # cd mod_limitipconn-0.04 [root @ ns mod_limitipconn-0.04] # lsapachesrc.diff ChangeLog Makefile mod_limitipconn.c README [root @ ns mod_limitipconn-0.04] # / usr / local / apache / bin / apxs -c -i -a mod_limitipconn.c gcc -DLINUX = 22 -I / usr / include / db1 -fpic -DSHARED_MODULE -I / usr / local / apache / include -c mod_limitipconn.cgcc -shared -o mod_limitipconn.so mod_limitipconn.o [ activating module `limitipconn 'in /usr/local/apache/conf/httpd.conf]cp mod_limitipconn.so /usr/local/apache/libexec/mod_limitipconn.sochmod 755 /usr/local/apache/libexec/mod_limitipconn.socp / usr /LOCAL/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bakcp /usr/local/apache/conf/httpd.conf.new /usr/local/apache/conf/httpd.confrm /usr/local/apache/conf/httpd.conf.new

Modify the configuration file:

1 Global control:

Plus the following lines in httpd.conf:

# All virtual hosts / directory MAXConnperip 3 # Each IP only allows 3 concurrent connection noiplimit image / * # p 不 限 限 限 <

# All hosts / mp3 Directory MaxConnperip 1 # Each IP only allows a connection to request Onlyiplimit Audio / MPEG Video # This limit is only on the video and audio format file 2 Local restrictions, You can also set IP restrictions in the configuration file of the virtual host, the method is exactly the same:

Serveradmin chenlf@chinalinuxupub.comDocument / home / myservername www.my.com # All virtual hosts / directory MAXConnperip 5 # Each IP is only allowed 3 Concurrent connection noiplimit image / * # Do not do IP limit # All hosts / mp3 directory MAXConnperip 2 # Each IP only allows only one connection request Onlyiplimit Audio / MPEG Video # This limit is only Video and audio format file ErrorLog / Home / My / Logs / Error_LogcustomLog / Home / MY / logs / access_log common

3 In addition, the apache's extendedStatus must be set to ON. Find the # extendedStatus on the previous note in httpd.conf.

Ok, all the configuration end, you can take effect on apache.

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

New Post(0)