Donate to support Ukraine's independence.
Fail2ban reading Nginx logs and banning attackers in Cloudflare

Auto-Ban Attackers in Cloudflare Using Fail2ban and Nginx Logs

Many of us use CloudFlare to protect our websites and services from malicious activity. In this post, I’ll show you how to configure Fail2ban to block bad actors directly on CloudFlare. Nginx setup Before we start, make sure your Nginx logs contain real client IP addresses. If your logs still show CloudFlare IPs, follow my earlier guide: Handling Real IP in Nginx Behind Load Balancer and Cloudflare ...

November 22, 2025 · Last Modified: October 21, 2026 · 3 min · 547 words · Serhii Kaidalov