Add Maxmind Editions support
This commit is contained in:
parent
130af33510
commit
78576a9bbc
7 changed files with 110 additions and 30 deletions
|
|
@ -159,6 +159,8 @@ http {
|
|||
{{ if $cfg.UseGeoIP2 }}
|
||||
# https://github.com/leev/ngx_http_geoip2_module#example-usage
|
||||
|
||||
{{ range $index, $file := $all.MaxmindEditionFiles }}
|
||||
{{ if eq $file "GeoLite2-City.mmdb" }}
|
||||
geoip2 /etc/nginx/geoip/GeoLite2-City.mmdb {
|
||||
$geoip2_city_country_code source=$remote_addr country iso_code;
|
||||
$geoip2_city_country_name source=$remote_addr country names en;
|
||||
|
|
@ -171,13 +173,52 @@ http {
|
|||
$geoip2_region_code source=$remote_addr subdivisions 0 iso_code;
|
||||
$geoip2_region_name source=$remote_addr subdivisions 0 names en;
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $file "GeoIP2-City.mmdb" }}
|
||||
geoip2 /etc/nginx/geoip/GeoIP2-City.mmdb {
|
||||
$geoip2_city_country_code source=$remote_addr country iso_code;
|
||||
$geoip2_city_country_name source=$remote_addr country names en;
|
||||
$geoip2_city source=$remote_addr city names en;
|
||||
$geoip2_postal_code source=$remote_addr postal code;
|
||||
$geoip2_dma_code source=$remote_addr location metro_code;
|
||||
$geoip2_latitude source=$remote_addr location latitude;
|
||||
$geoip2_longitude source=$remote_addr location longitude;
|
||||
$geoip2_time_zone source=$remote_addr location time_zone;
|
||||
$geoip2_region_code source=$remote_addr subdivisions 0 iso_code;
|
||||
$geoip2_region_name source=$remote_addr subdivisions 0 names en;
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $file "GeoLite2-ASN.mmdb" }}
|
||||
geoip2 /etc/nginx/geoip/GeoLite2-ASN.mmdb {
|
||||
$geoip2_asn source=$remote_addr autonomous_system_number;
|
||||
$geoip2_org source=$remote_addr autonomous_system_organization;
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $file "GeoIP2-ASN.mmdb" }}
|
||||
geoip2 /etc/nginx/geoip/GeoIP2-ASN.mmdb {
|
||||
$geoip2_asn source=$remote_addr autonomous_system_number;
|
||||
$geoip2_org source=$remote_addr autonomous_system_organization;
|
||||
}
|
||||
{{ end }}
|
||||
|
||||
{{ if eq $file "GeoIP2-ISP.mmdb" }}
|
||||
geoip2 /etc/nginx/geoip/GeoIP2-ISP.mmdb {
|
||||
$geoip2_isp isp;
|
||||
$geoip2_isp_org organization;
|
||||
}
|
||||
{{ end }}
|
||||
{{ if eq $file "GeoIP2-Connection-Type.mmdb" }}
|
||||
geoip2 /etc/nginx/geoip/GeoIP2-Connection-Type.mmdb {
|
||||
$geoip2_connection_type connection_type;
|
||||
}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
||||
|
||||
aio threads;
|
||||
aio_write on;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue