This mod downloads the dbip-country-lite.mmdb database under /config/geoip2db, the database is updated weekly.
This mod should not be enabled together with the swag-maxmind mod.
Follow these steps to enable the dbip mod:
-
In the container's docker arguments, set an environment variable
DOCKER_MODS=linuxserver/mods:swag-dbipIf adding multiple mods, enter them in an array separated by
|, such asDOCKER_MODS=linuxserver/mods:swag-dbip|linuxserver/mods:swag-mod2 -
Recreate the container to apply the changes.
-
Add the following line to
/config/nginx/nginx.confunder thehttpsection:include /config/nginx/dbip.conf;
-
Edit
/config/nginx/dbip.confand add countries to the blocklist / whitelist according to the comments, for example:geoip2 /config/geoip2db/dbip-country-lite.mmdb { auto_reload 1w; $geoip2_data_country_iso_code country iso_code; } map $geoip2_data_country_iso_code $geo-whitelist { default no; UK yes; } map $geoip2_data_country_iso_code $geo-blacklist { default yes; US no; } geo $lan-ip { default no; 192.168.0.0/24 yes; 172.20.0.0/16 yes; }
-
Use the definitions in the following way:
server { listen 443 ssl; listen [::]:443 ssl; server_name some-app.*; include /config/nginx/ssl.conf; client_max_body_size 0; if ($lan-ip = yes) { set $geo-whitelist yes; } if ($geo-whitelist = no) { return 404; } location / {
-
Restart the container to apply the changes.