1
我用geoip模塊成功地使用參數「--with-http-geoip-module」來編譯NGINX。如何在NGINX中可編程地查詢GeoIP
和數據庫在我的nginx.conf文件中指出。
http{
....
geoip_country /usr/lib/local/geoip.dat;
....
}
一切似乎都很好,並且該模塊加載沒有錯誤。
我已將自己的模塊添加到NGINX中。 ,我嘗試從地理模塊查詢geoip_country_code變量。
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,不能獲取位置信息。
有沒有人知道是什麼問題?