Merge pull request #6587 from tuusberg/add-geoip2-country
feat(nginx.tmpl): Add support for GeoLite2-Country and GeoIP2-Country databases
This commit is contained in:
commit
39b6593523
1 changed files with 16 additions and 0 deletions
|
@ -174,6 +174,22 @@ http {
|
||||||
# https://github.com/leev/ngx_http_geoip2_module#example-usage
|
# https://github.com/leev/ngx_http_geoip2_module#example-usage
|
||||||
|
|
||||||
{{ range $index, $file := $all.MaxmindEditionFiles }}
|
{{ range $index, $file := $all.MaxmindEditionFiles }}
|
||||||
|
{{ if eq $file "GeoLite2-Country.mmdb" }}
|
||||||
|
geoip2 /etc/nginx/geoip/GeoLite2-Country.mmdb {
|
||||||
|
$geoip2_country_code source=$remote_addr country iso_code;
|
||||||
|
$geoip2_country_name source=$remote_addr country names en;
|
||||||
|
$geoip2_continent_name source=$remote_addr continent names en;
|
||||||
|
}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
|
{{ if eq $file "GeoIP2-Country.mmdb" }}
|
||||||
|
geoip2 /etc/nginx/geoip/GeoIP2-Country.mmdb {
|
||||||
|
$geoip2_country_code source=$remote_addr country iso_code;
|
||||||
|
$geoip2_country_name source=$remote_addr country names en;
|
||||||
|
$geoip2_continent_name source=$remote_addr continent names en;
|
||||||
|
}
|
||||||
|
{{ end }}
|
||||||
|
|
||||||
{{ if eq $file "GeoLite2-City.mmdb" }}
|
{{ if eq $file "GeoLite2-City.mmdb" }}
|
||||||
geoip2 /etc/nginx/geoip/GeoLite2-City.mmdb {
|
geoip2 /etc/nginx/geoip/GeoLite2-City.mmdb {
|
||||||
$geoip2_city_country_code source=$remote_addr country iso_code;
|
$geoip2_city_country_code source=$remote_addr country iso_code;
|
||||||
|
|
Loading…
Reference in a new issue