This guide covers how to block unwanted traffic to protect your site from malicious bots and attackers.
Hackers can steal data, distribute spyware or ransomware, and even bring down entire websites. While legitimate bots crawl your pages for search indexing,
malicious bots may spam forms, scrape content, or post fake reviews.
In this guide, we’ll cover how to block unwanted traffic—whether it’s individual IPs, bots, or entire network ranges—to protect your site.
Status for the jail: nginx-http-auth|- Filter| |- Currently failed: 0| |- Total failed: 3| `- File list: /var/log/nginx/access.log`- Actions |- Currently banned: 1 `- Banned IP list: 108.172.85.62
Unban an IP if needed:
Copy
Ask AI
sudo fail2ban-client set nginx-http-auth unbanip 108.172.85.62
Fail2Ban operates independently of Nginx or SSH, so there’s no need to restart those services after making changes.These techniques—IP-based restrictions in Nginx and automated bans with Fail2Ban—can significantly reduce brute-force and bot-driven attacks. In containerized platforms like Kubernetes, you may need different integrations, but the core ideas carry over to any host-based environment.