{"id":2036,"date":"2017-09-23T17:21:57","date_gmt":"2017-09-23T11:51:57","guid":{"rendered":"https:\/\/pheonixsolutions.com\/blog\/?p=2036"},"modified":"2026-09-07T19:52:53","modified_gmt":"2026-09-07T14:22:53","slug":"install-mod-evasive-module-cpaneleasy-apache-4","status":"publish","type":"post","link":"https:\/\/pheonixsolutions.com\/blog\/install-mod-evasive-module-cpaneleasy-apache-4\/","title":{"rendered":"Install Mod evasive module on cPanel(Easy Apache 4 )"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This guide covers how to <strong>install mod_evasive on cPanel with EasyApache 4<\/strong>. <code>mod_evasive<\/code> is an Apache module that helps mitigate HTTP-level DoS and brute-force attacks by tracking request rates per IP and temporarily blocking addresses that exceed configured thresholds.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Current cPanel versions use EasyApache 4, and <code>mod_evasive<\/code> isn&#8217;t included by default \u2014 it&#8217;s available through cPanel&#8217;s <code>cl-ea4-experimental<\/code> repository instead.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Implementation<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">I. Prerequisites<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before you install mod_evasive on cPanel, make sure you have:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A cPanel\/WHM server running EasyApache 4<\/li>\n\n\n\n<li>SSH access with root privileges<\/li>\n\n\n\n<li>WHM access, for verifying the change afterward<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">II. How mod_evasive Works<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>mod_evasive<\/code> sits at the Apache request-handling level, counting how many requests each IP makes within a configured time window. If an IP exceeds the thresholds you set (requests to the same page, requests to the site overall, or too many concurrent requests), Apache temporarily blocks that IP by returning a 403 response instead of processing further requests \u2014 without needing a separate firewall rule.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">III. Install mod_evasive<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Log in to the server via SSH, then install the module using the experimental EA4 repository:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">yum install --enablerepo=cl-ea4-experimental ea-apache24-mod_evasive.x86_64\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Press <code>Y<\/code> when prompted to confirm.<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> <code>--enablerepo<\/code> only enables the experimental repository for this single command, rather than permanently \u2014 which is the safer approach, since permanently enabling an experimental repository could pull in other unintended experimental package updates on future <code>yum<\/code> operations.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">IV. Configure mod_evasive<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Create the configuration file:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">vi \/usr\/local\/apache\/conf\/includes\/mod_evasive.conf\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Add the following:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;IfModule mod_evasive20.c>\n    DOSHashTableSize    3097\n    DOSPageCount        2\n    DOSSiteCount        50\n    DOSPageInterval     1\n    DOSSiteInterval     1\n    DOSBlockingPeriod   3600\n    DOSLogDir           \"\/var\/log\/mod_evasive\"\n    DOSWhitelist        127.0.0.1\n&lt;\/IfModule>\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">V. Create the Log Directory<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">This is where the original setup instructions get it wrong: <code>DOSLogDir<\/code> needs to be a <strong>directory<\/strong>, not a file. <code>mod_evasive<\/code> writes a separate lock file per blocked IP into this location \u2014 if it&#8217;s created as a plain file (for example, with <code>touch<\/code>), the module has nowhere to write those per-IP lock files and will fail silently rather than actually blocking anything.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mkdir -p \/var\/log\/mod_evasive\nchown nobody:nobody \/var\/log\/mod_evasive\nchmod 700 \/var\/log\/mod_evasive\n<\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><strong>Note:<\/strong> Adjust the ownership user (<code>nobody<\/code> above) to match whichever user your Apache worker processes actually run as \u2014 this can vary depending on your specific cPanel\/EasyApache configuration. If Apache can&#8217;t write to this directory, <code>mod_evasive<\/code> won&#8217;t be able to track or block anything, even though the module itself loads correctly.<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">VI. Restart Apache<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">systemctl restart httpd\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">VII. Verify the Module Loaded<\/h3>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">httpd -M | grep eva\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Expected output:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">evasive24_module (shared)\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">VIII. Test That It&#8217;s Actually Blocking<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Confirming the module loaded isn&#8217;t the same as confirming it&#8217;s actually blocking traffic. From a machine other than the server itself, send a burst of rapid requests exceeding <code>DOSPageCount<\/code>:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">for i in {1..10}; do curl -s -o \/dev\/null -w \"%{http_code}\\n\" http:\/\/your-domain.com\/; done\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You should see the response codes shift to <code>403<\/code> partway through the loop once the threshold is exceeded, confirming the block is active.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">IX. Tuning the Thresholds<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The default values in Step IV are a reasonable starting point, but worth adjusting based on your actual traffic:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>DOSPageCount<\/code><\/strong> \u2014 lower this for stricter protection against rapid repeated requests to the same page; raise it if legitimate users (or something like a single-page app polling an endpoint) are getting blocked unexpectedly<\/li>\n\n\n\n<li><strong><code>DOSSiteCount<\/code><\/strong> \u2014 the overall request threshold across the whole site; tune based on your site&#8217;s normal peak traffic patterns<\/li>\n\n\n\n<li><strong><code>DOSWhitelist<\/code><\/strong> \u2014 add any IPs that should never be blocked, such as your own monitoring tools or a load balancer&#8217;s IP, in addition to <code>127.0.0.1<\/code><\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">X. Conclusion<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Installing mod_evasive on cPanel with EasyApache 4 comes down to enabling the experimental repository for the install, configuring the thresholds in <code>mod_evasive.conf<\/code>, and \u2014 critically \u2014 creating <code>DOSLogDir<\/code> as an actual directory with the correct ownership, not a file. Without that last detail, the module loads successfully but never actually blocks anything, since it has nowhere to write its per-IP tracking data.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Frequently Asked Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Why did the module load but never block any traffic?<\/strong> The most common cause is exactly the bug covered in Step V \u2014 <code>DOSLogDir<\/code> created as a file instead of a directory, or created as a directory but without write permissions for the user Apache actually runs as.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Will mod_evasive block legitimate traffic spikes, like a sudden surge of real visitors?<\/strong> It can, if thresholds are set too aggressively for your site&#8217;s normal traffic. Monitor your logs after enabling it and adjust <code>DOSPageCount<\/code> and <code>DOSSiteCount<\/code> upward if you see legitimate visitors getting blocked.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Is mod_evasive a replacement for a proper firewall or WAF?<\/strong> No \u2014 it&#8217;s a useful, lightweight layer specifically for HTTP-level request-rate abuse, but it doesn&#8217;t replace broader protections like a firewall (for network-level attacks) or a WAF (for application-layer exploit attempts).<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Talk to Our Technology Experts<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Looking to harden your cPanel server against abuse and attacks? Our team can help with server security, Apache configuration, and ongoing infrastructure support.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/pheonixsolutions.com\/contact\">Connect with our technology experts.<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/pheonixsolutions.com\/blog\/block-wordpress-login-attacks-csf\/\">Block WordPress Login Attacks on CSF<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction This guide covers how to install mod_evasive on cPanel with EasyApache 4. mod_evasive is an Apache module that helps [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[1019],"tags":[263,378],"class_list":["post-2036","post","type-post","status-publish","format-standard","hentry","category-cloud-aws","tag-cpanel","tag-mod_evasive","psol-cat-cloud-aws"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/phn2x7-wQ","jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2036","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=2036"}],"version-history":[{"count":1,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2036\/revisions"}],"predecessor-version":[{"id":11488,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2036\/revisions\/11488"}],"wp:attachment":[{"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2036"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2036"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pheonixsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2036"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}