The following procedure explains how you may customize your ModSecurity 2 configuration on your cPanel server.
First, check to see if the customization that you would like to make is available in the WHM UI:
1. Login to WHM as the root user
2. Navigate to: Home »Security Center »ModSecurity™ Configuration »Configure Global Directives
3. Review the many options to see if your desired customization is shown and make your desired edits
4. Click the blue "Save" button at the bottom of the page
If your desired configuration option is not found in the UI, you may customize the ModSecurity configuration with the following steps:
1. Login to the server via SSH as the root user, or access the Terminal feature via WHM as the root user
2. If the following file does not already exist create it with the following command:
3. Open the file with your favorite text editor and add your desired configuration. Please be sure to consult the ModSecurity Documentation when editing the configuration.
4. Rebuild the Apache configuration to include your new changes with the following command:
5. Restart Apache with the following command to load your changes:
NOTE: At the time of writing this article the SecDataDir directive is not editable on a cPanel server. We have a defect case filed with our developers. Please see the comment section at the bottom of the following article for the status of the case. If there are no comments, that means that our development team is still working on the issue. We will update the article with a comment when a fix is published: