Block or filter IPs based on location in Nginx (tested on 1.18.0) on Ubuntu 20.04.
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