1. Download source và install
- Chuyển về thư mực tmp hay đâu cũng được
cd /tmp
- download bản mới nhất
wget http://fossies.org/unix/www/apache_httpd_modules/mod_qos-10.13.tar.gz
- giải nén
tar xvfz mod_qos-10.13.tar.gz
- install các công cụ cần thiết
yum install apache2-threaded-dev gcc
2. Cài đặt
cd mod_qos-10.13/apache2/
apxs -i -c mod_qos.c
chmod 755 /usr/local/apache/modules/mod_qos.so (chmod 755 /usr/lib64/httpd/modules/mod_qos.so)
sửa config httpd:
nano /etc/httpd/conf/httpd.conf hoặc vi /etc/httpd/conf/httpd.conf
Thêm 2 dòng này vào:
LoadModule qos_module modules/mod_qos.so
Include "/usr/local/apache/conf/qos.conf" (Include "/etc/httpd/conf/qos.conf")
3. config mod_qos ( tao file /etc/httpd/conf/qos.conf )
nano /usr/local/apache/conf/qos.conf
Paste vào đó:
# maximum number of active TCP connections is limited to 256 (limited
# by the available memory, adjust the settings according to the used
# hardware):
MaxClients 256
# idle timeout:
Timeout 45
# keep alive (for up to 70% of all connections):
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 3
QS_SrvMaxConnClose 70%
QS_ClientEntries 1500
# minimum request/response speed (deny slow clients blocking the server,
# e.g. defending slowloris):
QS_SrvMinDataRate 150 1200
# don't allow more than 25 TCP connections per client source address:
QS_SrvMaxConnPerIP 25
Và save lại, sau đó restart apache.