[PATCH] Documented support for GeoIP2 databases in the MMDB format
Maxim Dounin
mdounin at mdounin.ru
Fri Dec 12 22:49:58 UTC 2025
# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1765579563 -10800
# Sat Dec 13 01:46:03 2025 +0300
# Node ID 4dd62a0a82169fc78d0c8593940ec374c4e2aa2e
# Parent b0c7016f88682d92a2892074d783c7a007d8621f
Documented support for GeoIP2 databases in the MMDB format.
diff --git a/xml/en/docs/configure.xml b/xml/en/docs/configure.xml
--- a/xml/en/docs/configure.xml
+++ b/xml/en/docs/configure.xml
@@ -8,7 +8,7 @@
<article name="Building nginx from Sources"
link="/en/docs/configure.html"
lang="en"
- rev="23">
+ rev="24">
<section>
@@ -1341,6 +1341,26 @@ sets additional build options for OpenSS
<list type="tag">
<tag-name>
+<literal>--without-geoip</literal>
+</tag-name>
+<tag-desc>
+disables use of the GeoIP library (1.29.4).
+</tag-desc>
+
+<tag-name>
+<literal>--without-libmaxminddb</literal>
+</tag-name>
+<tag-desc>
+disables use of the libmaxminddb library (1.29.4).
+</tag-desc>
+
+</list>
+</para>
+
+<para>
+<list type="tag">
+
+<tag-name>
<literal>--with-debug</literal>
</tag-name>
<tag-desc>
diff --git a/xml/en/docs/http/ngx_http_geoip_module.xml b/xml/en/docs/http/ngx_http_geoip_module.xml
--- a/xml/en/docs/http/ngx_http_geoip_module.xml
+++ b/xml/en/docs/http/ngx_http_geoip_module.xml
@@ -10,7 +10,7 @@
<module name="Module ngx_http_geoip_module"
link="/en/docs/http/ngx_http_geoip_module.html"
lang="en"
- rev="5">
+ rev="6">
<section id="summary">
@@ -21,7 +21,12 @@ with values depending on the client IP a
</para>
<para>
-When using the databases with IPv6 support (1.3.12, 1.2.7),
+The module supports both legacy GeoIP databases
+and new GeoIP2 databases in the MaxMind DB (MMDB) file format (1.29.4).
+</para>
+
+<para>
+When using legacy databases with IPv6 support (1.3.12, 1.2.7),
IPv4 addresses are looked up as IPv4-mapped IPv6 addresses.
</para>
@@ -31,7 +36,14 @@ This module is not built by default, it
configuration parameter.
<note>
This module requires the
-<link url="http://www.maxmind.com/app/c">MaxMind GeoIP</link> library.
+<link url="https://github.com/maxmind/geoip-api-c">MaxMind GeoIP</link>
+library
+to support loading of legacy GeoIP databases,
+and the
+<link url="https://github.com/maxmind/libmaxminddb">libmaxminddb</link>
+library
+to support loading of GeoIP2 databases
+in the MaxMind DB (MMDB) file format (1.29.4).
</note>
</para>
@@ -79,6 +91,9 @@ two-letter country code, for example,
<tag-desc>
three-letter country code, for example,
“<literal>RUS</literal>”, “<literal>USA</literal>”.
+<note>
+This variable is not available when using MMDB databases.
+</note>
</tag-desc>
<tag-name id="var_geoip_country_name"><var>$geoip_country_name</var></tag-name>
@@ -130,6 +145,9 @@ two-letter country code, for example,
<tag-desc>
three-letter country code, for example,
“<literal>RUS</literal>”, “<literal>USA</literal>”.
+<note>
+This variable is not available when using MMDB databases.
+</note>
</tag-desc>
<tag-name id="var_geoip_city_country_name"><var>$geoip_city_country_name</var>
@@ -154,7 +172,7 @@ in Google AdWords API.
<tag-name id="var_geoip_region"><var>$geoip_region</var></tag-name>
<tag-desc>
-two-symbol country region code (region, territory, state, province, federal land
+country region code (region, territory, state, province, federal land
and the like), for example,
“<literal>48</literal>”, “<literal>DC</literal>”.
</tag-desc>
@@ -241,6 +259,35 @@ non-trusted address sent in <header>X-Fo
</directive>
+
+<directive name="geoip_set">
+<syntax>
+ <value>$variable</value>
+ <value>file</value>
+ <value>path</value></syntax>
+<default/>
+<context>http</context>
+<appeared-in>1.29.4</appeared-in>
+
+<para>
+Creates a <value>variable</value>
+whose value is determinded
+from the specified database <value>file</value>
+with the specified data <value>path</value>,
+for example:
+<example>
+geoip_set $country GeoLite2-Country.mmdb country.names.en;
+geoip_set $region GeoLite2-City.mmdb subdivisions.0.iso_code;
+geoip_set $asn GeoLite2-ASN.mmdb autonomous_system_number;
+</example>
+</para>
+
+<para>
+This directive only supports MMDB databases.
+</para>
+
+</directive>
+
</section>
</module>
diff --git a/xml/en/docs/stream/ngx_stream_geoip_module.xml b/xml/en/docs/stream/ngx_stream_geoip_module.xml
--- a/xml/en/docs/stream/ngx_stream_geoip_module.xml
+++ b/xml/en/docs/stream/ngx_stream_geoip_module.xml
@@ -9,7 +9,7 @@
<module name="Module ngx_stream_geoip_module"
link="/en/docs/stream/ngx_stream_geoip_module.html"
lang="en"
- rev="1">
+ rev="2">
<section id="summary">
@@ -20,7 +20,12 @@ with values depending on the client IP a
</para>
<para>
-When using the databases with IPv6 support,
+The module supports both legacy GeoIP databases
+and new GeoIP2 databases in the MaxMind DB (MMDB) file format (1.29.4).
+</para>
+
+<para>
+When using legacy databases with IPv6 support,
IPv4 addresses are looked up as IPv4-mapped IPv6 addresses.
</para>
@@ -30,7 +35,14 @@ This module is not built by default, it
configuration parameter.
<note>
This module requires the
-<link url="http://www.maxmind.com/app/c">MaxMind GeoIP</link> library.
+<link url="https://github.com/maxmind/geoip-api-c">MaxMind GeoIP</link>
+library
+to support loading of legacy GeoIP databases,
+and the
+<link url="https://github.com/maxmind/libmaxminddb">libmaxminddb</link>
+library
+to support loading of GeoIP2 databases
+in the MaxMind DB (MMDB) file format (1.29.4).
</note>
</para>
@@ -51,7 +63,7 @@ stream {
NA na.example.com;
AS as.example.com;
}
- ...
+ ...
}
</example>
</para>
@@ -83,6 +95,9 @@ two-letter country code, for example,
<tag-desc>
three-letter country code, for example,
“<literal>RUS</literal>”, “<literal>USA</literal>”.
+<note>
+This variable is not available when using MMDB databases.
+</note>
</tag-desc>
<tag-name id="var_geoip_country_name"><var>$geoip_country_name</var></tag-name>
@@ -134,6 +149,9 @@ two-letter country code, for example,
<tag-desc>
three-letter country code, for example,
“<literal>RUS</literal>”, “<literal>USA</literal>”.
+<note>
+This variable is not available when using MMDB databases.
+</note>
</tag-desc>
<tag-name id="var_geoip_city_country_name"><var>$geoip_city_country_name</var>
@@ -158,7 +176,7 @@ in Google AdWords API.
<tag-name id="var_geoip_region"><var>$geoip_region</var></tag-name>
<tag-desc>
-two-symbol country region code (region, territory, state, province, federal land
+country region code (region, territory, state, province, federal land
and the like), for example,
“<literal>48</literal>”, “<literal>DC</literal>”.
</tag-desc>
@@ -208,6 +226,35 @@ organization name, for example, “The University of Melbourne”.
</directive>
+
+<directive name="geoip_set">
+<syntax>
+ <value>$variable</value>
+ <value>file</value>
+ <value>path</value></syntax>
+<default/>
+<context>http</context>
+<appeared-in>1.29.4</appeared-in>
+
+<para>
+Creates a <value>variable</value>
+whose value is determinded
+from the specified database <value>file</value>
+with the specified data <value>path</value>,
+for example:
+<example>
+geoip_set $country GeoLite2-Country.mmdb country.names.en;
+geoip_set $region GeoLite2-City.mmdb subdivisions.0.iso_code;
+geoip_set $asn GeoLite2-ASN.mmdb autonomous_system_number;
+</example>
+</para>
+
+<para>
+This directive only supports MMDB databases.
+</para>
+
+</directive>
+
</section>
</module>
diff --git a/xml/ru/docs/configure.xml b/xml/ru/docs/configure.xml
--- a/xml/ru/docs/configure.xml
+++ b/xml/ru/docs/configure.xml
@@ -8,7 +8,7 @@
<article name="Сборка nginx из исходных файлов"
link="/ru/docs/configure.html"
lang="ru"
- rev="23">
+ rev="24">
<section>
@@ -1321,6 +1321,26 @@ 1.1.3—1.3) нужно взять на сайте
<list type="tag">
<tag-name>
+<literal>--without-geoip</literal>
+</tag-name>
+<tag-desc>
+запрещает использование библиотеки GeoIP (1.29.4).
+</tag-desc>
+
+<tag-name>
+<literal>--without-libmaxminddb</literal>
+</tag-name>
+<tag-desc>
+запрещает использование библиотеки libmaxminddb (1.29.4).
+</tag-desc>
+
+</list>
+</para>
+
+<para>
+<list type="tag">
+
+<tag-name>
<literal>--with-debug</literal>
</tag-name>
<tag-desc>
diff --git a/xml/ru/docs/http/ngx_http_geoip_module.xml b/xml/ru/docs/http/ngx_http_geoip_module.xml
--- a/xml/ru/docs/http/ngx_http_geoip_module.xml
+++ b/xml/ru/docs/http/ngx_http_geoip_module.xml
@@ -10,7 +10,7 @@
<module name="Модуль ngx_http_geoip_module"
link="/ru/docs/http/ngx_http_geoip_module.html"
lang="ru"
- rev="5">
+ rev="6">
<section id="summary">
@@ -21,7 +21,12 @@
</para>
<para>
-При использовании баз данных с поддержкой IPv6 (1.3.12, 1.2.7)
+Модуль поддерживает как базы данных GeoIP в старом формате,
+так и новые базы данных GeoIP2 в формате MaxMind DB (MMDB) (1.29.4).
+</para>
+
+<para>
+При использовании баз данных в старом формате с поддержкой IPv6 (1.3.12, 1.2.7)
IPv4-адреса ищутся отображёнными на IPv6.
</para>
@@ -30,8 +35,12 @@ IPv4-адреса ищутся отображёнными на IPv6.
разрешить с помощью конфигурационного параметра
<literal>--with-http_geoip_module</literal>.
<note>
-Для сборки и работы этого модуля нужна библиотека
-<link url="http://www.maxmind.com/app/c">MaxMind GeoIP</link>.
+Для сборки и работы этого модуля требуются библиотеки:
+<link url="https://github.com/maxmind/geoip-api-c">MaxMind GeoIP</link>
+для работы с базами данных в старом формате
+и
+<link url="https://github.com/maxmind/libmaxminddb">libmaxminddb</link>
+для работы с базами данных в формате MaxMind DB (MMDB) (1.29.4).
</note>
</para>
@@ -79,6 +88,9 @@ http {
<tag-desc>
трёхбуквенный код страны, например,
“<literal>RUS</literal>”, “<literal>USA</literal>”.
+<note>
+Эта переменная недоступна при использовании баз данных в формате MMDB.
+</note>
</tag-desc>
<tag-name id="var_geoip_country_name"><var>$geoip_country_name</var></tag-name>
@@ -131,6 +143,9 @@ http {
<tag-desc>
трёхбуквенный код страны, например,
“<literal>RUS</literal>”, “<literal>USA</literal>”.
+<note>
+Эта переменная недоступна при использовании баз данных в формате MMDB.
+</note>
</tag-desc>
<tag-name id="var_geoip_city_country_name"><var>$geoip_city_country_name</var>
@@ -155,7 +170,7 @@ Google AdWords API.
<tag-name id="var_geoip_region"><var>$geoip_region</var></tag-name>
<tag-desc>
-двухсимвольный код региона страны (область, край, штат,
+код региона страны (область, край, штат,
провинция, федеральная земля и тому подобное), например,
“<literal>48</literal>”, “<literal>DC</literal>”.
</tag-desc>
@@ -240,6 +255,35 @@ Google AdWords API.
</directive>
+
+<directive name="geoip_set">
+<syntax>
+ <value>$переменная</value>
+ <value>файл</value>
+ <value>путь</value></syntax>
+<default/>
+<context>http</context>
+<appeared-in>1.29.4</appeared-in>
+
+<para>
+Создаёт <value>переменную</value>,
+значение которой будет определяться
+из базы данных в <value>файле</value>
+по указанному <value>пути</value> к данным,
+например:
+<example>
+geoip_set $country GeoLite2-Country.mmdb country.names.en;
+geoip_set $region GeoLite2-City.mmdb subdivisions.0.iso_code;
+geoip_set $asn GeoLite2-ASN.mmdb autonomous_system_number;
+</example>
+</para>
+
+<para>
+Эта директива поддерживает только базы данных в формате MMDB.
+</para>
+
+</directive>
+
</section>
</module>
diff --git a/xml/ru/docs/stream/ngx_stream_geoip_module.xml b/xml/ru/docs/stream/ngx_stream_geoip_module.xml
--- a/xml/ru/docs/stream/ngx_stream_geoip_module.xml
+++ b/xml/ru/docs/stream/ngx_stream_geoip_module.xml
@@ -9,7 +9,7 @@
<module name="Модуль ngx_stream_geoip_module"
link="/ru/docs/stream/ngx_stream_geoip_module.html"
lang="ru"
- rev="1">
+ rev="2">
<section id="summary">
@@ -20,7 +20,12 @@
</para>
<para>
-При использовании баз данных с поддержкой IPv6
+Модуль поддерживает как базы данных GeoIP в старом формате,
+так и новые базы данных GeoIP2 в формате MaxMind DB (MMDB) (1.29.4).
+</para>
+
+<para>
+При использовании баз данных в старом формате с поддержкой IPv6
IPv4-адреса ищутся отображёнными на IPv6.
</para>
@@ -29,8 +34,12 @@ IPv4-адреса ищутся отображёнными на IPv6.
разрешить с помощью конфигурационного параметра
<literal>--with-stream_geoip_module</literal>.
<note>
-Для сборки и работы этого модуля нужна библиотека
-<link url="http://www.maxmind.com/app/c">MaxMind GeoIP</link>.
+Для сборки и работы этого модуля требуются библиотеки:
+<link url="https://github.com/maxmind/geoip-api-c">MaxMind GeoIP</link>
+для работы с базами данных в старом формате
+и
+<link url="https://github.com/maxmind/libmaxminddb">libmaxminddb</link>
+для работы с базами данных в формате MaxMind DB (MMDB) (1.29.4).
</note>
</para>
@@ -51,7 +60,7 @@ stream {
NA na.example.com;
AS as.example.com;
}
- ...
+ ...
}
</example>
</para>
@@ -83,6 +92,9 @@ stream {
<tag-desc>
трёхбуквенный код страны, например,
“<literal>RUS</literal>”, “<literal>USA</literal>”.
+<note>
+Эта переменная недоступна при использовании баз данных в формате MMDB.
+</note>
</tag-desc>
<tag-name id="var_geoip_country_name"><var>$geoip_country_name</var></tag-name>
@@ -135,6 +147,9 @@ stream {
<tag-desc>
трёхбуквенный код страны, например,
“<literal>RUS</literal>”, “<literal>USA</literal>”.
+<note>
+Эта переменная недоступна при использовании баз данных в формате MMDB.
+</note>
</tag-desc>
<tag-name id="var_geoip_city_country_name"><var>$geoip_city_country_name</var>
@@ -159,7 +174,7 @@ Google AdWords API.
<tag-name id="var_geoip_region"><var>$geoip_region</var></tag-name>
<tag-desc>
-двухсимвольный код региона страны (область, край, штат,
+код региона страны (область, край, штат,
провинция, федеральная земля и тому подобное), например,
“<literal>48</literal>”, “<literal>DC</literal>”.
</tag-desc>
@@ -209,6 +224,35 @@ Google AdWords API.
</directive>
+
+<directive name="geoip_set">
+<syntax>
+ <value>$переменная</value>
+ <value>файл</value>
+ <value>путь</value></syntax>
+<default/>
+<context>http</context>
+<appeared-in>1.29.4</appeared-in>
+
+<para>
+Создаёт <value>переменную</value>,
+значение которой будет определяться
+из базы данных в <value>файле</value>
+по указанному <value>пути</value> к данным,
+например:
+<example>
+geoip_set $country GeoLite2-Country.mmdb country.names.en;
+geoip_set $region GeoLite2-City.mmdb subdivisions.0.iso_code;
+geoip_set $asn GeoLite2-ASN.mmdb autonomous_system_number;
+</example>
+</para>
+
+<para>
+Эта директива поддерживает только базы данных в формате MMDB.
+</para>
+
+</directive>
+
</section>
</module>
More information about the nginx-devel
mailing list