安装ngx_geoip2
安装geoip2扩展依赖
yum -y install geoip yum -y install libmaxminddb-devel
下载ngx_http_geoip2_module
git clone https://github.com/leev/ngx_http_geoip2_module.git
编译安装nginx(已有nginx的不需要make install)
./configure --add-dynamic-module=/path/to/ngx_http_geoip2_module --另有其他参数 gmake gmake install (已安装的在./build/nginx-xx/objs/文件夹下,复制nginx覆盖现有版本,然后拷贝ngx_http_geoip2.so文件到配置目录)