ModSecurity Web Application Firewall

ModSecurity is a Web Application Firewall. Protect sites from SQL injection and Application level hacking.

To install ModSecurity on Ubuntu/Debian with Apache, run

apt install libapache2-mod-security2 -y

verify Apache module is installed with

apachectl -M | grep security

Enable config file

mv /etc/modsecurity/modsecurity.conf-recommended /etc/modsecurity/modsecurity.conf

Update config

sed -i "s/SecRuleEngine DetectionOnly/SecRuleEngine On/" /etc/modsecurity/modsecurity.conf
sed -i "s/SecResponseBodyAccess On/SecResponseBodyAccess Off/" /etc/modsecurity/modsecurity.conf

Restart Apache

systemctl restart apache2
Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *