Module: mod_evasive
Role: Prevent DDOS attacks
Introduction: The predecessor of the mod_evasive module is mod_dosevasive.
Download: http://www.nuclearelephant.com/projects/mod_evasive
Install
# Tar zxvf mod_evasive_1.10.1.tar.gz
# Cd mod_evasive_1.10.1
#/Usr/local/apache/bin/apxs-I-a-c mod_evasive20.c
Open the httpd. conf file
Check whether
LoadModule evasive20_module modules/mod_evasive+so
If not, add it.
And add it to httpd. conf.
#################################
<IfModule mod_evasive20.c>
DOSHashTableSize 3097
DOSPageCount 2
DOSSiteCount 50
Dospageinterval 1
Dossiteinterval 1
Dosblockingperiod 10
</Ifmodule>
###################################
Module: mod_security
Role: enhances Apache Security, especially in anti-SQL injection.
Download: http://www.modsecurity.org/download/
Install
# Tar zxvf modsecurity-apache-1.9.tar.gz
# Cd modsecurity-apache-1.9/apache2/
#/Apache2/bin/apxs-CIA mod_security.c
Open the httpd. conf file
Check whether
Loadmodule security_module modules/mod_security.so
If not, add it.
And add it to httpd. conf.
#################################
<Ifmodule mod_security.c>
Secfilterengine on
Secfiltercheckurlencoding on
Secfilterdefaultaction "Deny, log, status: 500"
# Secfilterforcebyterange 32 126.
# Secfilterscanpost on
Secauditlog logs/audit_log
###
Secfilter "/././"
#####
Secfilter/etc/* passwd
Secfilter/bin/* Sh
# For CSS attack
Secfilter "<(|) * script"
Secfilter "<(. |) +>"
# For SQL attack
Secfilter "Delete [] + from"
Secfilter "insert [] +"
Secfilter "Select. + from"
Secfilter "Union [] + from"
Secfilter "drop []"
</Ifmodule>
###############################
Module: mod_deflate
Purpose: compress webpages to speed up Web browsing
Download: apache2 comes
Install
#/Usr/local/apache2/bin/apxs-I-a-c/root/httpd-2.0.48/modules/filters/mod_deflate.c
Check whether
LoadModule deflate_module modules/mod_deflate.so
If not, add it.
Edit the httpd. conf file and add the following content:
######################################
DeflateFilterNote ratio
Logformat' "% v % h % l % u % t" % r "%> s % B" % {Referer} I "" % {User-Agent} I ""( % {ratio} n) 'deflate
<Location/>
SetOutputFilter DEFLATE
BrowserMatch ^ Mozilla/4 gzip-only-text/html
BrowserMatch ^ Mozilla/4.0 [678] no-gzip
BrowserMatch/bMSIE! No-gzip! Gzip-only-text/html
SetEnvIfNoCase Request_URI /.(? : Gif | jpe? G | png) $ no-gzip dont-vary
# Header append Vary User-Agent env =! Dont-vary
</Location>
# Search for the original line commented by Customlog and change it
CustomLog logs/deflate_log deflate
######################################
<Location/>
SetOutputFilter DEFLATE
BrowserMatch ^ Mozilla/4 gzip-only-text/html
BrowserMatch ^ Mozilla/4.0 [678] no-gzip
BrowserMatch/bMSIE! No-gzip! Gzip-only-text/html
SetEnvIfNoCase Request_URI /.(? : Gif | jpe? G | png) $ no-gzip dont-vary
# Header append Vary User-Agent env =! Dont-vary
</Location>
# Search for the original line commented by Customlog and change it
CustomLog logs/deflate_log deflate