Nginx & Dynamic banlist

I have block list of IP addresses in a file. How can I make this file a ban list for Nginx? This ban list resets every 5 minutes, it's a dynamic list.


Solution 1:

Create a script which converts the file into a list of Deny X.X.X.X;. Add include directive with this file into your nginx config. Run the script when the ban list is updated and reload nginx.

Alternatively, use a commercial solution NGINX Plus Dynamic Denylisting of IP Addresses