Select Page

How to install mod_security 2.5.7

How to install mod_security 2.5.7
ModSecurityTM is an open source intrusion detection and prevention engine for web applications (or a web application firewall). Operating as an Apache Web server module or standalone, the purpose of ModSecurity is to increase web application security, protecting web applications from known and unknown attacks. from

You’ll have to create a free account at to get the real link

# cd
# wget
# tar -zxfv modsecurity-apache_2.5.7.tar.gz
# cd modsecurity-apache_2.5.7/apache2
# ./configure
# make

Copy the library to /usr/lib/apache2 

# cp /root/modsecurity-apache_2.5.7/apache2/.libs/ /usr/lib/apache2/  

Then copy all latest rules into apache2/conf.d folder

# cp -r /root/modsecurity-apache_2.5.7/rules/etc/apache2/conf.d/

Copy the minimal configuration file into apache2/conf.d folder

# cp /root/modsecurity-apache_2.5.7/modsecurity.conf-minimal /etc/apache2/conf.d/modsecurity2.conf

Add this line at the top of modsecurity2.conf

LoadModule security2_module /usr/lib/apache2/

Restart apache2 by executing

# rcapache2 restart

Verify proper operations by looking at log files

# tail -f /var/log/apache2/modsec_debug_log

Attention this is my location for log files!


  • audit log location line 191
  • debug log location line 285

in /etc/apache2/conf.d/rules/modsecurity_crs_10_config.conf

About The Author

Cédric Walter

I worked with various Insurances companies across Switzerland on online applications handling billion premium volumes. I love to continuously spark my creativity in many different and challenging open-source projects fueled by my great passion for innovation and blockchain technology.In my technical role as a senior software engineer and Blockchain consultant, I help to define and implement innovative solutions in the scope of both blockchain and traditional products, solutions, and services. I can support the full spectrum of software development activities, starting from analyzing ideas and business cases and up to the production deployment of the solutions.I'm the Founder and CEO of Disruptr GmbH.