$ show mitchellkrogza/nginx-ultimate-bad-bot-blocker
This repository provides a comprehensive Nginx security configuration package to block malicious bots, spam referrers, bad IPs, and vulnerability scanners. It includes curated blocklists (bad user agents, referrers, IPs, fake Googlebots), rate limiting/DDoS protection, and optional fail2ban integration. The core deliverable is a set of modular Nginx include files (bots.d/, conf.d/) and shell scripts (install-ngxblocker, setup-ngxblocker, update-ngxblocker) for automated deployment and daily updates. It also generates Google Analytics ghost spam exclusion lists and a Google Search Console disavow file. The architecture is a collection of configuration templates and deployment tooling, not a standalone application; it is designed to be included into existing Nginx server blocks. The repository is actively maintained with frequent updates to blocklists and CI testing across multiple Linux distributions.
The LLM identified 5 files worth highlighting for reuse:
A robust shell script that downloads and installs the latest Nginx bot blocker configuration files to /etc/nginx/. Supports custom paths, dry-run mode (-x), verbose output, and email notifications. It is self-contained, parameterized, and can be extracted for use in other deployment pipelines.
Automates the insertion of bot blocker includes into nginx.conf and vhost files. Supports multiple Linux distributions (Ubuntu, CentOS, Arch, etc.) with distribution-specific templates. Includes whitelisting of domains and IPs. The script is modular and can be adapted for other Nginx configuration management tasks.
A cron-ready script that fetches the latest globalblacklist.conf from GitHub and reloads Nginx. It supports custom paths, Mailgun notifications, and dry-run. Demonstrates a clean pattern for periodic updates of server configuration files.
The main Nginx configuration file that checks $bad_bot, $bad_words, $bad_referer, and $validate_client variables to return 444 (drop connection) for malicious traffic. It uses a super whitelist pattern to allow specific IPs to bypass all blocking. This modular include pattern is reusable for any Nginx-based security filtering.
A Fail2Ban action that writes banned IPs to a persistent text file and re-adds them on restart, ensuring bans survive Fail2Ban restarts. This is a reusable pattern for persistent banning in Fail2Ban setups.