0

Can nginx block ~20.000 ips?

And should i block ips (https://lists.blocklist.de/lists/all.txt) with nginx?

1 Answers1

0

Theoretically yes, you could block those IPs by using the deny config option in nginx: e.g., with the file /etc/nginx/denyip.conf

deny 1.1.1.1;
deny 2.2.2.0/24;
deny 3.3.3.3;

And then in /etc/nginx/nginx.conf in your HTTP block

include denyip.conf;

However, you shouldn't really be blocking IP addresses with Nginx. It is much better to block them with your firewall, so they can't connect to your server at all, instead of being able to connect to everything but Nginx.

  • tx, makes sense now you mention it. So you would block them at the Ubuntu ufw level for instance or at the router level? – Je Je May 18 '23 at 09:38