「Nginx」- Nginx GeoIP2 Module | ngx_http_geoip2_module | by leev

官网:
文档:
仓库:https://github.com/leev/ngx_http_geoip2_module

ngx_http_geoip2_module – creates variables with values from the maxmind geoip2 databases based on the client IP (default) or from a specific variable (supports both IPv4 and IPv6). 简而言之,通过 GeoIP2 模块,实现 IP Address 到地理位置的转化,进而进行更多操作。

性质

The module now supports nginx streams and can be used in the same way the http module can be used.

应用

Example Usage | https://github.com/leev/ngx_http_geoip2_module?tab=readme-ov-file#example-usage

http {
    ...
    geoip2 /etc/maxmind-city.mmdb {
        $geoip2_data_city_name default=London city names en;
    }
    ...
}