ngx_stream_geoip_module
ngx_stream_geoip_module 모듈(1.11.3)은 사전 컴파일된 MaxMind 데이터베이스를 사용하여 클라이언트 IP 주소에 따라 값이 있는 변수를 생성합니다.
IPv6가 지원되는 데이터베이스를 사용할 경우, IPv4 주소를 IPv4에 매핑된 IPv6 주소로 검색합니다.
이 모듈은 기본적으로 구축되지 않으므로 –with-stream_geoip_module 구성 매개변수로 활성화해야 합니다.
이 모듈은 MaxMind GeoIP 라이브러리가 필요합니다.
예제 구성
stream {
geoip_country GeoIP.dat;
geoip_city GeoLiteCity.dat;
map $geoip_city_continent_code $nearest_server {
default example.com;
EU eu.example.com;
NA na.example.com;
AS as.example.com;
}
...
}
Directives
Syntax: geoip_country file;
Default: —
Context: stream
클라이언트 IP 주소에 따라 국가를 알아내는 데 사용하는 데이터베이스를 지정합니다. 이 데이터베이스를 사용할 때는 다음의 변수를 사용할 수 있습니다.
$geoip_country_code
2자 국가 코드(예: “RU”, “US”)
$geoip_country_code3
3자 국가 코드(예: “RUS”, “USA”)
$geoip_country_name
국가 이름(예: “Russian Federation”, “United States”)
Syntax: geoip_city file;
Default: —
Context: stream
클라이언트 IP 주소에 따라 국가, 지역, 도시를 알아내는 데 사용하는 데이터베이스를 지정합니다. 이 데이터베이스를 사용할 때는 다음의 변수를 사용할 수 있습니다.
$geoip_area_code
전화 지역 번호(미국 전용).
해당 데이터베이스 필드는 사용이 중단되었으므로 이 변수에는 오래된 정보가 포함되었을 수 있습니다.
$geoip_city_continent_code
2자 대륙 코드(예: “EU”, “NA”)
$geoip_city_country_code
2자 국가 코드(예: “RU”, “US”)
$geoip_city_country_code3
3자 국가 코드(예: “RUS”, “USA”)
$geoip_city_country_name
국가 이름(예: “Russian Federation”, “United States”)
$geoip_dma_code
미국의 DMA 지역 코드(일명 “도시 코드”), Google AdWords API의 geotargeting 기준.
$geoip_latitude
위도.
$geoip_longitude
경도.
$geoip_region
기호 2개로 구성된 국가 지역 코드(지역, 영토, 주, 도, 연방령 등, 예: “48”, “DC”)
$geoip_region_name
국가 지역 이름(지역, 영토, 주, 도, 연방령 등, 예: “Moscow City”, “District of Columbia”)
$geoip_city
도시 이름(예: “Moscow”, “Washington”)
$geoip_postal_code
우편번호.
Syntax: geoip_org file;
Default: —
Context: stream
클라이언트 IP 주소에 따라 조직을 알아내는 데 사용하는 데이터베이스를 지정합니다. 이 데이터베이스를 사용할 때는 다음의 변수를 사용할 수 있습니다.
$geoip_org
조직 이름(예: “The University of Melbourne”)