Linux – Apache mod_evasive doesn’t load

apache-2.2centoslinux

I am on a VPS (CentOs) running Apache and I would like to install Mod_Evasive. The problem is that I follow the installation steps without error but Apache doesn't load the module. Here are the step that I have done.

1) wget http://www.zdziarski.com/blog/wp-content/uploads/2010/02/mod_evasive_1.10.1.tar.gz

2) tar xzf mod_evasive_1.10.1.tar.gz

3) cd mod_evasive

4) apxs -cia mod_evasive20.c

5) nano /etc/httpd/conf/mod_evasive.conf

6) paste that in the .conf:

   <IfModule mod_evasive20.c>
   DOSHashTableSize 3097
   DOSPageCount  2
   DOSSiteCount  50
   DOSPageInterval 1
   DOSSiteInterval  1
   DOSBlockingPeriod  10
   DOSLogDir   /var/log/mod_evasive
   DOSEmailNotify  admin@email.com
   DOSWhitelist   127.0.0.1
   </IfModule>

7) nano /etc/httpd/conf/httpd.conf
Add :

 LoadModule evasive20_module modules/mod_evasive20.so
 Include "/etc/httpd/conf/mod_evasive.conf"

8) mkdir /var/log/mod_evasive

9) /etc/init.d/httpd restart

10) php -r 'phpinfo();' | grep -i evasive

The last command show nothing about mod_evasive. What am I doing wrong?

Best Answer

10) php -r 'phpinfo();' | grep -i evasive

This command only shows information about your PHP stack, it does not talk to Apache or mod_evasive().

To have server info on your phpinfo(); you have to run it from a server, so watch the output from a browser.

Or use

apachectl -M

(Instead of apachectl, you may need to put apache2 or apache2ctl, depending on your installation)