Introduction
A ModSecurity rule may be impacting a user, and you want to only disable the rule for that user. User-level Apache include files used on a cPanel server can be used to disable the rule.
Procedure
Please note that, in the following procedure, "$cpuser" must be replaced with the cPanel user's username.
- Access the server's command line as the 'root' user via SSH or "Terminal" in WHM.
- Use the following command to create the cPanel user's include folders.
mkdir -p /etc/apache2/conf.d/userdata/std/2_4/$cpuser /etc/apache2/conf.d/userdata/ssl/2_4/$cpuser
- Create the user's configuration file.
touch /etc/apache2/conf.d/userdata/std/2_4/$cpuser/modsec.conf
- Open the file in your preferred text editor.
- Add the following lines to the file.
<LocationMatch .*>
Please note that "$ruleID" must be replaced with the ModSecurity rule ID to be disabled.
SecRuleRemoveById $ruleID
</LocationMatch> - Save the changes and exit the text editor.
- Copy the configuration to the user's
ssl
folder.
cp -av /etc/apache2/conf.d/userdata/std/2_4/$cpuser/modsec.conf /etc/apache2/conf.d/userdata/ssl/2_4/$cpuser/modsec.conf
- Rebuild the Apache configuration.
/scripts/rebuildhttpdconf
- Restart the web server.
/scripts/restartsrv_httpd --hard
Additional Resources
How to use Apache includes to add configuration directives to all VirtualHosts server-wide
Comments
0 comments
Article is closed for comments.