Nginx geoip模块

L:80

需要编译进 --with-http_geoip_module

首先要安装maxMind里的geoip的c开发库

https://dev.maxmind.com/geoip/legacy/downloadable/

首先 nginx是用c写的 所以要下载c 版本的 MaxMind  

然后解压缩 GeoIP-1.6.12.tar.gz 并进入目录 用./configure 编译后  再make 、 make install 

安装后 一般默认库的 位置在  /usr/share/GeoIP/
里面会有 GeoIP.dat GeoIPV6.dat 两个库文件

Syntax: geoip_city file 表示下载安装地址库绝对路径;
Default:
Context: http

geoip_city变量说

$geoip_latitude 维度

$geoip_longitude 经度

$geoip_city_continent_code 属于全球哪个洲

$geoip_country_code、geoip_country_code3、$geoip_country_name 与下面三个变量类似

$geoip_region 洲或省编码 如 :02

$geoip_region_name 洲或省名称 如:shanghai 

$geoip_city 城市名称

$geoip_postal_code 邮编

Syntax: geoip_country file 表示下载安装地址库绝对路径;
Default:
Context: http

geoip_country变量说明

$geoip_country_code 两个字母国家编码 如:CN、US

$geoip_country_code3 三个字母的国家编码 如:CHN USA

$geoip_country_name 国家全称 如: 'China'  'United States'

Syntax: geoip_proxy address | CIDR 提供可信地址;
Default:
Context: http
原文地址:https://www.cnblogs.com/jackey2015/p/10407510.html