Mod_Security is a web firewall module for Apache web servers that provides an excellent first line of defense against web-based attacks and exploits. We will cover installation and configuration of mod_security in a future article, but if you already have mod_sec installed, read on.
Whitelist an IP Address in Mod_Security Configuration
With a good, strict ruleset for mod_security, the firewall may occasionally block you as a false positive when trying to post certain content to the server. A simple solution is to add your PC or workstation’s public IP address to the mod_security whitelist, avoiding the need to temporarily disable mod_security rule enforcement.
First, find your modsec2.whitelist.conf configuration file. On cPanel/WHM servers using ConfigServer’s ModSec Control plugin, use the plugin interface in WHM to locate and edit modsec2.whitelist.conf. On other Linux servers, the file name will contain whitelist.conf.
Add this line to to configuration file and save:
SecRule REMOTE_ADDR "^192\.168\.200\.201$" phase:1,log,allow,ctl:ruleEngine=Off,id:999945
Take care to replace the IP address numbers with your own IP address. You can enter “what is my IP” on Google if you’re unsure.
With this rule in place, no mod_sec rules will be checked for your IP address.