Web Hosting & VPS Tips

Unleash Your Server Potential with Expert Insights

Hosting provided by: Cloudways
Free to Try! Up to 40% Off!

Category: VPS Setup

Protect Apache with Fail2ban on Ubuntu—install with
apt install fail2ban apache2
then create /etc/fail2ban/jail d/apache conf via
nano /etc/fail2ban/jail.d/apache.conf
:
[apache-auth]\nenabled = true\nport = 80,443\nfilter = apache-auth\nlogpath = /var/log/apache2/error.log\nmaxretry = 5\nbantime = 3600
Restart with
systemctl restart fail2ban
open ports with
ufw allow 80 && ufw allow 443
Test by failing logins at http://ip—check bans with
fail2ban-client status apache-auth
On Hetzner this secures phpMyAdmin and web uptime—enable Apache logging with LogLevel warn in /etc/apache2/apache2 conf for Fail2ban to parse

Back to All Tips