---
title: How to Install and Configure ModSecurity in WHM
description: "ModSecurity is a powerful web application firewall (WAF) designed to protect your server and hosted websites from security threats such as SQL injections, cross-site scripting, and other common attacks. This guide explains how to install and configure ModSecurity in WHM.…"
url: "https://truehost.com/support/knowledge-base/how-to-install-and-configure-modsecurity-in-whm/"
updated: "2024-12-03"
category: Cloud servers in Kenya
---

# How to Install and Configure ModSecurity in WHM

ModSecurity is a powerful web application firewall (WAF) designed to protect your server and hosted websites from security threats such as SQL injections, cross-site scripting, and other common attacks. This guide explains how to install and configure ModSecurity in WHM.

Below is are steps on how to install ModSecurity on a cPanel server.s

- **[Login to your server using SSH.](https://truehost.com/support/knowledge-base/how-to-access-a-server-via-ssh-terminal/)**
- Uninstall ModSecurity if you had installed it, You cab use the command below

```
yum remove ea-apache24-mod_security2
```

- You can then install connectors that that allow mod-security to work with a web-server. Run the appropriate command depending on the web-server that you are using.
- **For Apache**

```
yum install ea-modsec30-connector-apache24
```

- **For Nginx**

```
yum install ea-modsec30-connector-nginx
```

- Now log in to WHM of the **Destination Serve**r either with the root account. Normally you will use one of the URLs below;

```
http://your_server_ip:2087

https://your_server_hostname:2087
```

![This image has an empty alt attribute; its file name is image-703.png](https://truehost.com/support/wp-content/uploads/2024/11/image-703.png)

- Under the Software section, click on the** EasyApache 4.**

![](https://truehost.com/support/wp-content/uploads/2024/12/image-89.png)

- Click on the **customize** button.

![](https://truehost.com/support/wp-content/uploads/2024/12/image-90.png)

- Navigate to Additional Packages and confirm that the controller is installed. If you are working with apache, ensure that modsec30-connector-apache24 is installed. For Nginx, you require modsec30-connector-nginx.

![](https://truehost.com/support/wp-content/uploads/2024/12/image-91.png)

- You now need to enable them by toggling the toggle buttons

![](https://truehost.com/support/wp-content/uploads/2024/12/image-92.png)

- Click on the **Next**, then on **Review** then on **Provision** button to complete the installation.

![](https://truehost.com/support/wp-content/uploads/2024/12/image-93.png)

![](https://truehost.com/support/wp-content/uploads/2024/12/image-94.png)

![](https://truehost.com/support/wp-content/uploads/2024/12/image-95.png)

- Next is to install the OWASP Core Rule Set using the below command.

```
yum install ea-modsec30-rules-owasp-crs
```

#### **Configuring ModSecurity**

- In the ModSecurity configuration, you can customize various global settings, including the audit log behavior, rules engine, and connection engine.

![](https://truehost.com/support/wp-content/uploads/2024/12/image-96-1024x268.png)

![](https://truehost.com/support/wp-content/uploads/2024/12/image-97.png)

- Please see [this document](https://docs.cpanel.net/whm/security-center/modsecurity-tools/)or more details

#### **ModSecurity Tools**

ModSecurity Tools provide options for monitoring and managing the firewall rules. You can view all the rules, enable or disable them as needed, and even add new rules as required.

![](https://truehost.com/support/wp-content/uploads/2024/12/image-98.png)

**ModSecurity Vendors**

The ModSecurity Vendors section allows you to add and manage different rule sets.

![](https://truehost.com/support/wp-content/uploads/2024/12/image-99-1024x317.png)

For example, you can view, activate, or deactivate the installed OWASP CRS rule set.

Additionally, you can edit or exclude specific rule sets, such as IP reputation or WordPress exclusions, based on your needs.

![](https://truehost.com/support/wp-content/uploads/2024/12/image-100-1024x463.png)

You can also check the following cPanel Articles regarding ModSecurity.

### [ModSecurity®](https://docs.cpanel.net/cpanel/security/modsecurity/)

### [ModSecurity® Tools](https://docs.cpanel.net/whm/security-center/modsecurity-tools/)
