dockernginxgeoipgeoip2geolite2

How can i access the GeoLite database in nginx?


I run a Nginx proxy and want to use the GeoLite2-Country/city databases. I followed the instructions on "https://docs.nginx.com/nginx/admin-guide/dynamic-modules/geoip2/" and "https://github.com/leev/ngx_http_geoip2_module". So I have the required Nginx-module. Also I installed Libmaxminddb.

When I want to build my Docker-File I get this error:

"MMDB_open("/geoip/GeoLite2-City.mmdb") failed - Error opening the specified MaxMind DB file in /etc/nginx/nginx.conf:17"

In the command window I can access to the Mmdb via

      $ mmdblookup --file /etc/nginx/geoip/GeoIP/GeoIP2-Country.mmdb --ip 8.8.8.8

source: "https://github.com/leev/ngx_http_geoip2_module"

So the file should be accessible.. (the path is different because the nginx.conf path starts at etc/nginx.

Maybe anyone have some idea I can try or faced the same problem?

Thank you and best regards from earth!

UPDATE: I am using "Alpine 3.13.5" && "Nginx-1.21.0"


Solution

  • The path in Nginx.conf needed to be a full path! Otherwise than the loaded module.