Disable Mod-security2 for a Domain in cPanel
- Category : Linux Helpline (Easy Guide)
- Posted on : Apr 15, 2019
- Views : 2,946
- By : Hagen V.
First of all we can’t block mod_security2 via .htaccess on domain basis . So never put .htaccess mod-security rules. You have to disable it in the vhost configuration in apache.
In cpanel server it will be as follows,
1) Create a custom vhost configuration file called mod-security.conf in the following location.
# mkdir -pv /usr/local/apache/conf/userdata/std/2/CPUSER/DOMAINNAME/
# touch /usr/local/apache/conf/userdata/std/2/CPUSER/DOMAINNAME/mod-security.conf
2) Now add the following lines to this file
#################################
<IfModule mod_security2.c>
SecRuleEngine Off
</IfModule>
################################
The above will disable the modsecurity rule for a particulr domain name . If you only need to disable the rules for a particlur folder , please add the rules as follows,
######################
<LocationMatch specify_the_path_here>
<IfModule mod_security2.c>
SecRuleEngine Off
</IfModule>
</LocationMatch>
#######################
If you only need to disable a particular rule , the create the file with the following ,
#########################3
<IfModule mod_security2.c>
SecRuleRemoveById give_ruleID_here
</IfModule>
##########################
3) Now as the final step please ensure this custom vhost using the following command in cpanel servers,
# /scripts/ensure_vhost_includes –user=CPUSERNAME
This script will uncomment the following line in apache configuration. It will customize the virtual host to use the particular include file and will restart apache.
##############
Include “/usr/local/apache/conf/userdata/std/2/CPUSER/DOMAINNAME/*.conf”
#################
Categories
- cPanel Question 47
- cPanel Software Management 29
- cPanel Tutorials 13
- Development 29
- Domain 13
- General 19
- Linux Helpline (Easy Guide) 156
- Marketing 47
- MySQL Question 13
- News 2
- PHP Configuration 14
- SEO 4
- SEO 42
- Server Administration 84
- SSL Installation 54
- Tips and Tricks 24
- VPS 3
- Web Hosting 44
- Website Security 22
- WHM questions 13
- WordPress 148
Subscribe Now
10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!Archive Calendar
Sat | Sun | Mon | Tue | Wed | Thu | Fri |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 | 31 |
Recent Articles
-
Posted on : Sep 17
-
Posted on : Sep 10
-
Posted on : Aug 04
-
Posted on : Apr 01
Tags
- ts
- myisam
- vpn
- sql
- process
- kill
- tweak
- server load
- attack
- ddos mitigation
- Knowledge
- layer 7
- ddos
- webmail
- DMARC
- Development
- nginx
- seo vpn
- Hosting Security
- wireguard
- innodb
- exim
- smtp relay
- smtp
- VPS Hosting
- cpulimit
- Plesk
- Comparison
- cpu
- encryption
- WHM
- xampp
- sysstat
- optimize
- cheap vpn
- php-fpm
- mariadb
- apache
- Small Business
- Error
- Networking
- VPS
- SSD Hosting
- Link Building
- centos
- DNS
- optimization
- ubuntu