Nginx and GeoLite2 not working

Solution 1:

ngx_mod_http_geoip is not compatible with GeoIP2 databases; you will need the ngx_http_geoip2_module instead. Note, however, that as of this writing the nginx distribution packages I'm aware of don't include the ngx_http_geoip2_module and you will need to compile NGINX from source and include ngx_http_geoip2_module. See these instructions for an example of building this for Ubuntu.

Disclaimer: I wrote these instructions.

Solution 2:

I found this site https://www.miyuru.lk/geoiplegacy which has recent datasets in DAT format converted from newer database formats.

These are compatible with the older nginx geoip module. So no need to build the geoip2 module from source.