1
geoip 모듈과 함께 성공적으로 매개 변수 "--with-http-geoip-module"을 사용하여 NGINX를 컴파일합니다.NGINX에서 GeoIP를 프로그래밍 방식으로 쿼리하는 방법
이며 데이터베이스는 내 nginx.conf 파일에 표시됩니다.
http{
....
geoip_country /usr/lib/local/geoip.dat;
....
}
이 모듈은 오류없이로드됩니다.
나는 자체 모듈을 NGINX에 추가했습니다. 와 내가 쿼리하려고 시도했습니다. geoip_country_code geo module의 변수입니다.
static ngx_int_t
ngx_http_cms_url_handler(ngx_http_request_t *r)
{
ngx_str_t variable_name = ngx_string("geoip_country_code");
ngx_http_variable_value_t * geoip_country_code_var = ngx_http_get_variable(r, &variable_name, 0);
ngx_log_debug(NGX_LOG_INFO, r->connection->log, 0, "ngx_http_get_variable[%d]", geoip_country_code_var->not_found);
}
는 NOT_FOUND는 항상 1이고 위치 정보를 얻을 수 없습니다.
누구에게 무슨 문제가 있는지 알고 있나요?