nginx配置geoip

按照http://wiki.nginx.org/HttpGeoIPModule就可以了

有一个坑,就是

http {
geoip_country /path/to/GeoIP.dat; #这里一定要写绝对路径
geoip_city /path/to/GeoLiteCity.dat;

查了一下手册,好像没有$nginx_home这样的变量,所以需要写死?..

总结一下:
1.先安装依赖libgeoip-dev
2.去下载需要的ip库http://geolite.maxmind.com/download/geoip/database/
3.重新编译nginx
4.修改nginx配置

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>