{"id":1886,"date":"2020-10-22T04:21:36","date_gmt":"2020-10-22T04:21:36","guid":{"rendered":"https:\/\/ubiq.co\/tech-blog\/?p=1886"},"modified":"2025-10-07T04:45:54","modified_gmt":"2025-10-07T04:45:54","slug":"how-to-install-fail2ban-to-protect-apache-server","status":"publish","type":"post","link":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/","title":{"rendered":"How to Install Fail2ban to Protect Apache Server"},"content":{"rendered":"\n<p>It is very important to protect your website from malicious attacks such as Brute force attack and DDOS( distributed denial of service). For this purpose, it is essential to install a firewall on your system and configure traffic rules to block requests from malicious IPs. Fail2ban is a useful firewall &amp; intrusion prevention framework that automatically detects and blocks brute force attacks on your servers. It analyzes server logs for such malicious attacks and blocks those IP addresses using IP tables. Here&#8217;s how to install Fail2ban on Ubuntu, CentOS systems.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#What_is_Fail2ban\" >What is Fail2ban<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#How_Fail2ban_Works\" >How Fail2ban Works<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#How_to_Install_Fail2ban_to_Protect_Apache_Server\" >How to Install Fail2ban to Protect Apache Server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#1_Update_System\" >1. Update System<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#2_Install_Fail2ban\" >2. Install Fail2ban<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#3_Restart_Fail2ban\" >3. Restart Fail2ban<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#4_Configure_Fail2ban\" >4. Configure Fail2ban<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#5_Edit_Configuration_File\" >5. Edit Configuration File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#6_Create_Custom_Filter\" >6. Create Custom Filter<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#7_Restart_Fail2ban\" >7. Restart Fail2ban<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#8_Check_Fail2ban_status\" >8. Check Fail2ban status<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#Conclusion\" >Conclusion<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"What_is_Fail2ban\"><\/span>What is Fail2ban<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Fail2ban is a powerful, simple and easy to use firewall system that detects and prevents intrusion to your system. It is written in Python programming language but it can be installed on Windows, Linux as well as Mac systems without any python dependencies. It is commonly used to protect major web servers such as Apache and NGINX from brute force SSH login attempts. Fail2ban can also be setup to send you email alerts whenever a hacking attempt is thwarted.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_Fail2ban_Works\"><\/span>How Fail2ban Works<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Fail2ban mainly monitors the different application logs on your system to track intrusion attempts, records the related IP addresses and automatically blocks them. It is mainly used to block SSH intrusion attempts but it can be used to monitor any application by simply configuring it to monitor that application&#8217;s log files. It uses smart regular expressions to identify even clever hacking attempts and automatically block malicious IPs. It makes use of &#8216;jails&#8217; that are a set of firewall rules applicable for suspicious IP addresses.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"How_to_Install_Fail2ban_to_Protect_Apache_Server\"><\/span>How to Install Fail2ban to Protect Apache Server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Here are the steps to install Fail2ban for Apache web server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Update_System\"><\/span>1. Update System<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Open terminal and run the following command to update your system.<\/p>\n\n\n\n<p><strong>Ubuntu\/Debian<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt-get update <\/pre>\n\n\n\n<p><strong>CentOS\/RHEL\/Fedora<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># <code>sudo yum install -y epel-release<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Install_Fail2ban\"><\/span>2. Install Fail2ban<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p><strong>Ubuntu\/Debian<\/strong><\/p>\n\n\n\n<p>Fail2ban is supported by APT package manager in Ubuntu\/Debian systems. Run the following command to install Fail2ban in Ubuntu server.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo apt-get install fail2ban -y<\/pre>\n\n\n\n<p><strong>CentOS\/Redhat\/Fedora<\/strong><\/p>\n\n\n\n<p>Yum package manager supports Fail2ban for CentOS\/RHEL\/Fedora systems. Run the following commands to install Fail2ban in CentOS server.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"># <code>sudo yum install -y fail2ban<\/code><\/pre>\n\n\n\n<p>Bonus Read : <a href=\"https:\/\/ubiq.co\/tech-blog\/top-aws-cost-optimization-best-practices\/\">Top AWS Cost Optimization Best Practices<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Restart_Fail2ban\"><\/span>3. Restart Fail2ban<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Once you have installed Fail2ban on your system, you can use the same commands irrespective of your Linux distribution.<\/p>\n\n\n\n<p>Restart Fail2ban to apply changes<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo service fail2ban restart<\/pre>\n\n\n\n<p>Bonus Read : <a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-memcached-in-apache\/\">How to Install memcached in Apache<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Configure_Fail2ban\"><\/span>4. Configure Fail2ban<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Next, we will create a configuration file to customize it. <a href=\"https:\/\/github.com\/fail2ban\/fail2ban\" target=\"_blank\" rel=\"noreferrer noopener\">Fail2ban<\/a> will look for a file named jail.local and read its contents for configuration. However, this file doesn&#8217;t exist by default. But it comes with a jail.conf file. So we will create jail.local by duplicating jail.conf.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo cp \/etc\/fail2ban\/jail.conf \/etc\/fail2ban\/jail.local<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_Edit_Configuration_File\"><\/span>5. Edit Configuration File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Paste the following lines into this file.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[DEFAULT] \n ignoreip = 127.0.0.1\/8 ::1 \n bantime = 3600 \n findtime = 600 \n maxretry = 5 \n [sshd] \n enabled = true<\/pre>\n\n\n\n<p>Save and close the file.<\/p>\n\n\n\n<p>In the above configuration, we instruct Fail2ban to ignore IP address 127.0.0.1 that is localhost. In the remaining lines we specify different time limits in seconds. For example, if there are 5 re-attempts (maxretry=5) within 600 seconds(findtime=600), then those IP addresses should be banned for 3600 seconds (bantim=3600), that is, 1 hour. You can change these settings as per your requirement.<\/p>\n\n\n\n<p>The above are default settings applicable to all services. You can override them by creating a separate section for the specific service name in [&#8230;]. Here is an example for SSHD service. You can use the following configuration for basic protection of SSH service.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[sshd]<br>enabled = true<br>port = ssh<br>filter = sshd<br>logpath = \/var\/log\/auth.log<br>maxretry = 3<br>findtime = 600<br>bantime = 3600<\/pre>\n\n\n\n<p>In the above configuration.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Enabled &#8211; enables jail for SSH service<\/li>\n\n\n\n<li>Port &#8211; port number that the SSH service is running on<\/li>\n\n\n\n<li>Filter &#8211; name of filter to be used, usually the name of process<\/li>\n\n\n\n<li>Logpath &#8211; Log file location of SSH service which will be monitored by Fail2ban<\/li>\n\n\n\n<li>Maxretry &#8211; maximum number of failed attempts allowed before IP is banned<\/li>\n\n\n\n<li>Findtime &#8211; Time duration in seconds during which failed attempts are considered for ban. You can also set it in minutes such as 10m for 10 minutes.<\/li>\n\n\n\n<li>Bantime &#8211; Time duration of ban in seconds. Default value is 10 minutes. You can also set this value in minutes by adding &#8216;m&#8217; such as 10m for 10 minutes.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6_Create_Custom_Filter\"><\/span>6. Create Custom Filter<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Fail2ban makes use of regular expressions, known as filters, to quickly identify malicious behavior in requests. Fail2ban scans the log files for these regular expressions to identify attacks. These filters are located at \/etc\/fail2ban\/filter.d without .conf extension. You can add your filters by creating new files in this directory. However, the default filters are more than enough to catch the most common attacks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"7_Restart_Fail2ban\"><\/span>7. Restart Fail2ban<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Restart Fail2ban to apply changes.<\/p>\n\n\n\n<pre id=\"block-11180f52-35c1-4c24-8e55-50854cd63619\" class=\"wp-block-preformatted\">$ sudo service fail2ban restart<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"8_Check_Fail2ban_status\"><\/span>8. Check Fail2ban status<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Run the following command to check Fail2ban status<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ sudo service fail2ban status\n$ active(running)<\/pre>\n\n\n\n<p>Bonus Read : <a href=\"https:\/\/ubiq.co\/tech-blog\/top-5-log-management-tools-for-monitoring-analysis\/\">Top 5 Log Management Tools for Server Monitoring<\/a><\/p>\n\n\n\n<p>If you want to check the list of IP addresses banned by Fail2ban, run the following command.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ iptables -S<\/pre>\n\n\n\n<p>Most hackers and bots use automated scripts to target ports 80 and 443. You may also want to <a href=\"https:\/\/ubiq.co\/tech-blog\/how-to-change-port-number-in-apache-in-ubuntu\/\">change port number of Apache server<\/a> so that it becomes difficult for bots and hackers to guess.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>In this article, we have learnt what is Fail2ban, how it works and how to install &amp; configure it. It is very important to run some kind of firewall application to protect your web server in today&#8217;s world. Fail2ban is one of the most popular ones, alongside iptables and ufw. It is free and works well on Windows, Linux and Mac systems. Hopefully, this article will help you protect your Apache Server and SSH from brute force attacks. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Fail2ban protects websites from brute force attacks. Here&#8217;s how to install Fail2ban for Apache in Ubuntu, CentOS.<\/p>\n","protected":false},"author":1,"featured_media":1899,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[202],"class_list":["post-1886","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apache","tag-fail2ban"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Install Fail2ban to Protect Apache Server - Ubiq BI<\/title>\n<meta name=\"description\" content=\"Fail2ban protects websites from brute force attacks. Here&#039;s how to install Fail2ban for Apache in Ubuntu, CentOS to protect Apache web server and SSH.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Fail2ban to Protect Apache Server - Ubiq BI\" \/>\n<meta property=\"og:description\" content=\"Fail2ban protects websites from brute force attacks. Here&#039;s how to install Fail2ban for Apache in Ubuntu, CentOS to protect Apache web server and SSH.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Ubiq BI\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/ubiqbi\" \/>\n<meta property=\"article:published_time\" content=\"2020-10-22T04:21:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-07T04:45:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/10\/install-configure-fail2ban.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1300\" \/>\n\t<meta property=\"og:image:height\" content=\"899\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sreeram Sreenivasan\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:site\" content=\"@UbiqBI\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sreeram Sreenivasan\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/\"},\"author\":{\"name\":\"Sreeram Sreenivasan\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"headline\":\"How to Install Fail2ban to Protect Apache Server\",\"datePublished\":\"2020-10-22T04:21:36+00:00\",\"dateModified\":\"2025-10-07T04:45:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/\"},\"wordCount\":933,\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/install-configure-fail2ban.jpg?fit=1300%2C899&ssl=1\",\"keywords\":[\"fail2ban\"],\"articleSection\":[\"Apache\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/\",\"name\":\"How to Install Fail2ban to Protect Apache Server - Ubiq BI\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/install-configure-fail2ban.jpg?fit=1300%2C899&ssl=1\",\"datePublished\":\"2020-10-22T04:21:36+00:00\",\"dateModified\":\"2025-10-07T04:45:54+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\"},\"description\":\"Fail2ban protects websites from brute force attacks. Here's how to install Fail2ban for Apache in Ubuntu, CentOS to protect Apache web server and SSH.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/install-configure-fail2ban.jpg?fit=1300%2C899&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/ubiq.co\\\/tech-blog\\\/wp-content\\\/uploads\\\/2020\\\/10\\\/install-configure-fail2ban.jpg?fit=1300%2C899&ssl=1\",\"width\":1300,\"height\":899,\"caption\":\"install fail2ban in ubuntu, centos\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/how-to-install-fail2ban-to-protect-apache-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Install Fail2ban to Protect Apache Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#website\",\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/\",\"name\":\"Ubiq BI\",\"description\":\"Build dashboards &amp; reports in minutes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/#\\\/schema\\\/person\\\/db98d49a766a3a111d8510935ab90abc\",\"name\":\"Sreeram Sreenivasan\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g\",\"caption\":\"Sreeram Sreenivasan\"},\"description\":\"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.\",\"sameAs\":[\"https:\\\/\\\/www.linkedin.com\\\/in\\\/sreeram-sreenivasan\\\/\"],\"url\":\"https:\\\/\\\/ubiq.co\\\/tech-blog\\\/author\\\/wordpress\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install Fail2ban to Protect Apache Server - Ubiq BI","description":"Fail2ban protects websites from brute force attacks. Here's how to install Fail2ban for Apache in Ubuntu, CentOS to protect Apache web server and SSH.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/","og_locale":"en_US","og_type":"article","og_title":"How to Install Fail2ban to Protect Apache Server - Ubiq BI","og_description":"Fail2ban protects websites from brute force attacks. Here's how to install Fail2ban for Apache in Ubuntu, CentOS to protect Apache web server and SSH.","og_url":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/","og_site_name":"Ubiq BI","article_publisher":"https:\/\/www.facebook.com\/ubiqbi","article_published_time":"2020-10-22T04:21:36+00:00","article_modified_time":"2025-10-07T04:45:54+00:00","og_image":[{"width":1300,"height":899,"url":"https:\/\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/10\/install-configure-fail2ban.jpg","type":"image\/jpeg"}],"author":"Sreeram Sreenivasan","twitter_card":"summary_large_image","twitter_creator":"@UbiqBI","twitter_site":"@UbiqBI","twitter_misc":{"Written by":"Sreeram Sreenivasan","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#article","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/"},"author":{"name":"Sreeram Sreenivasan","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"headline":"How to Install Fail2ban to Protect Apache Server","datePublished":"2020-10-22T04:21:36+00:00","dateModified":"2025-10-07T04:45:54+00:00","mainEntityOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/"},"wordCount":933,"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/10\/install-configure-fail2ban.jpg?fit=1300%2C899&ssl=1","keywords":["fail2ban"],"articleSection":["Apache"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/","url":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/","name":"How to Install Fail2ban to Protect Apache Server - Ubiq BI","isPartOf":{"@id":"https:\/\/ubiq.co\/tech-blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#primaryimage"},"image":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/10\/install-configure-fail2ban.jpg?fit=1300%2C899&ssl=1","datePublished":"2020-10-22T04:21:36+00:00","dateModified":"2025-10-07T04:45:54+00:00","author":{"@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc"},"description":"Fail2ban protects websites from brute force attacks. Here's how to install Fail2ban for Apache in Ubuntu, CentOS to protect Apache web server and SSH.","breadcrumb":{"@id":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#primaryimage","url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/10\/install-configure-fail2ban.jpg?fit=1300%2C899&ssl=1","contentUrl":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/10\/install-configure-fail2ban.jpg?fit=1300%2C899&ssl=1","width":1300,"height":899,"caption":"install fail2ban in ubuntu, centos"},{"@type":"BreadcrumbList","@id":"https:\/\/ubiq.co\/tech-blog\/how-to-install-fail2ban-to-protect-apache-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ubiq.co\/tech-blog\/"},{"@type":"ListItem","position":2,"name":"How to Install Fail2ban to Protect Apache Server"}]},{"@type":"WebSite","@id":"https:\/\/ubiq.co\/tech-blog\/#website","url":"https:\/\/ubiq.co\/tech-blog\/","name":"Ubiq BI","description":"Build dashboards &amp; reports in minutes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ubiq.co\/tech-blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/ubiq.co\/tech-blog\/#\/schema\/person\/db98d49a766a3a111d8510935ab90abc","name":"Sreeram Sreenivasan","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4b3127ed2d4bb8efb3fa0bbb52cf2efd4d0156c97fc05a503537c883e8279947?s=96&d=mm&r=g","caption":"Sreeram Sreenivasan"},"description":"Sreeram Sreenivasan is the Founder of Ubiq. He has helped many Fortune 500 companies in the areas of BI &amp; software development.","sameAs":["https:\/\/www.linkedin.com\/in\/sreeram-sreenivasan\/"],"url":"https:\/\/ubiq.co\/tech-blog\/author\/wordpress\/"}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/ubiq.co\/tech-blog\/wp-content\/uploads\/2020\/10\/install-configure-fail2ban.jpg?fit=1300%2C899&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/pbGGTT-uq","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1886","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/comments?post=1886"}],"version-history":[{"count":32,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1886\/revisions"}],"predecessor-version":[{"id":9725,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/posts\/1886\/revisions\/9725"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media\/1899"}],"wp:attachment":[{"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/media?parent=1886"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/categories?post=1886"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubiq.co\/tech-blog\/wp-json\/wp\/v2\/tags?post=1886"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}