How to Install mod_security on a cPanel Server (Linux)

ModSecurity, or mod_security, is an open source web application firewall, commonly installed in conjunction with Apache, an open source web server. The benefits of using mod_security are numerous, and encompass defense from many kinds of web-based attack including code injection and brute force attacks. 

If you manage your server with WHM/cPanel, installation and administration of mod_security is very simple. Note that you should only attempt this installation if you have root access to your server.

First, it's necessary to install the core mod_security plugin via WHM's EasyApache utility. To run the utility, log in to WHM and navigate to the EasyApache section. Begin building a profile according to your preferred settings, and be sure to select mod_security for installation with your build. Build the profile and allow time for it to complete.

At this point, mod_security will be installed on your server, but administration remains somewhat advanced if you would prefer to work within a control panel. Fortunately, ConfigServer produces a free cPanel plugin to bring a mod_security interface within the WHM panel. The plugin is called ConfigServer ModSecurity Control (cmc).

To install the plugin, access your server as the root user via SSH, and run the following command: 

wget;tar -xzf cmc.tgz;cd cmc/;sh

Check your terminal to ensure a successful installation with no errors. If all went well, you can refresh WHM and navigate to the Plugins section. Select the ConfigServer ModSecurity plugin, and enjoy configuring your free new web application firewall! 

Note that this process will not install a mod_security rule set, so it will not offer any security "out of the box." We have posted another article containing a basic mod_security ruleset that can be copied into the cmc plugin interface. 

  • 2 Users Found This Useful
Was this answer helpful?

Related Articles

How to Access a Linux Server via SSH Terminal

When Linux dedicated servers are provisioned, they are often setup with a minimal OS...

How To Check if a Server is Online/Offline (Ping)

Is your server offline, or do you suspect it might be?The first step toward resolving the issue...

How to Ping a Linux Server (Windows/Mac/Linux)

A very simple network connectivity test is to employ ping (ICMP) packets to test the...

HELP! What should I do if my server is offline?

First, don't panic! If your server is really offline, you should be able to get it up and...

How to Trace Route an IP Address (Windows/Mac/Linux)

Performing a trace route is a common test used to view the status of individual "hops" along...