fail2ban filters – custom rules using regexp

fail2ban

fail2Ban is a very handy tool to prevent a lot of unwanted traffic from consuming bandwidth on your servers. It’s a minimal and relatively simple IDS Type Tool that comes with some predefined filters to automatically lockout potentially dangerous or bandwidth-consuming type attacks.

1. creating a custom filter

/etc/fail2ban/filter.d/custom.conf
[Definition]
 
Read more

How to Redirect HTTP to HTTPS in apache

Install modules

yum install -y mod_ssl  mod_rewrite

Enable modules

a2enmod rewrite
a2enmod ssl

Method 1

using rewrite module

<VirtualHost *:80>
ServerName www.yourdomain.com
  
RewriteEngine On 
RewriteCond %{HTTPS} !=on 
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
</VirtualHost>

Method 2

using redirect method

<VirtualHost *:80>
ServerName www.yourdomain.com 
  
Redirect permanent / https://www.yourdomain.com/
</VirtualHost>

Read more

How to set up Reverse Proxy in Apache/httpd

Install and enable apache2 proxy modules

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod proxy_balancer
sudo a2enmod lbmethod_byrequests
sudo systemctl restart apache2

proxies all requests (“/”) to a single backend:

ProxyPass "/"  "http://www.example.com/"

to point to the reverse proxy, instead of back to itself, the ProxyPassReverse directive is most often … Read more

How To Redirect www to non-www OR non-www to www with Apache

1. Configure DNS Records

In order to set up the desired redirect, www.example.com to example.com or vice versa, you must have an A record for each name.

2. Enable the mod_rewrite module

 a2enmod rewrite

3.1 Update site.conf or .htaccess file ( www to non-www)

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.yoursite.com 
RewriteRule 
Read more