本文摘自PHP中文网,作者(*-*)浩,侵删。

GeoIP过滤器根据来自Maxmind GeoLite2数据库的数据添加有关IP地址的地理位置的信息。
通过IP区别国内或国外,从而跳转到不同的页面,最终用nginx的第三方module:geoip来实现,这就不说它的优势了,网上很多解释,下面看怎么配置 ( 推荐学习:nginx使用 )
我的系统中是配置了nignx.repo的,我直接用yum来安装了geoip模块,没有用添加模块重编的方式
1 | yum install nginx-module-geoip
|
下载geoip的数据库文件
1 2 3 4 5 6 7 8 9 10 11 | cd /etc/nginx
mkdir geoipdat
cd geoipdat
下载
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
解压
gunzip GeoIP.dat.gz
gunzip GeoLiteCity.dat.gz
|
根据需求配置nginx
阅读剩余部分
相关阅读 >>
nginx如何实现端口转发
通过修改nginx配置文件解决上传文件大小限制问题
如何完全卸载nginx
linux如何启动nginx?
ssl证书加在nginx哪里
nginx在做负载均衡时如何配置
nginx是web容器么
nginx配置文件实例详解
nginx的geoip有什么用
nginx 可以用yum安装吗
更多相关阅读请进入《nginx》频道 >>
转载请注明出处:木庄网络博客 » nginx使用geoip做区域限制