Skip to content

Instantly share code, notes, and snippets.

View OccTherapist's full-sized avatar
🟢

Igor Clauss OccTherapist

🟢
View GitHub Profile
@OccTherapist
OccTherapist / GeoIP Block NGINX Ubuntu 20.04.md
Last active October 2, 2025 08:34 — forked from dunderrrrrr/GeoIP Block NGINX Ubuntu 20.04.md
Allow or block GeoIP in Nginx on Ubuntu 20.04

GeoIP Block NGINX Ubuntu 24.04

Block or filter IPs based on location in Nginx (tested on 1.24.0) on Ubuntu 24.04.

Install Nginx modules

To make use of the geographical filtering, we must first install the Nginx GeoIP module as well as the GeoIP database containing the mappings between visitors’ IP addresses and their respective countries. To do so, let’s execute:

$ sudo apt install libnginx-mod-http-geoip geoip-database