How to enable mod_security protection from cPanel. mod_security is an essential solution for protecting websites against web threats.
Enabling it from cPanel is a simple but effective process that significantly contributes to the overall security of the server and hosted web applications.
How to enable mod_security protection?
What is mod_security?
mod_security is a security module for Apache web servers, designed to protect web applications against common attacks such as SQL injection, cross-site scripting (XSS), and other vulnerabilities.
It functions as a Web Application Firewall (WAF), analyzing and filtering HTTP traffic in real time.
Benefits of using mod_security
- Automatic blocking of malicious requests to the website.
- Protection against the most common types of web attacks.
- Compatibility with custom rules for advanced needs.
Accessing cPanel and finding the mod_security option
- Log in to your cPanel account.
- Go to the Security section.
- Click on ModSecurity or Mod Security, depending on the cPanel interface used.
Enabling mod_security for domains
After accessing the mod_security page:
- You will see a list of domains associated with the cPanel account.
- Next to each domain there is an On/Off button for enabling or disabling protection.
- To enable protection, press On next to the desired domain.
mod_security will immediately start protecting the website against suspicious traffic.
Global activation (for all domains)
Some cPanel versions also offer the global activation option:
- At the top of the page, look for the Enable All button or Activate All Domains.
- Click to enable mod_security protection on all domains simultaneously.
Verifying mod_security functionality
To verify if mod_security is working:
- You can consult the
error_logfiles to see if certain requests are blocked by the firewall. - Alternatively, you can use a WAF testing tool or send simulated attack requests (with caution) and monitor the server response.
Managing mod_security rules (for advanced users)
In some cases, mod_security may block legitimate requests.
In such situations, it is possible to temporarily disable protection or add custom rules, but these actions are usually performed at root level or by the server administrator.
Usage recommendations
- Keep mod_security protection active permanently for all domains.
- Avoid disabling the module without consulting a specialist.
- Use security logs for monitoring blocked activities.

Comments (0)