本文摘自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
阅读剩余部分
相关阅读 >>
教你如何在linux中安装nginx服务器
nginx和tomcat怎么在一起工作
linux下nginx重启命令是什么?
nginx怎么配置负载均衡
nginx部署~dotnetcore+mvc网站502
nginx版本区别
怎么查看nginx端口
nginx的特点有哪些
linux如何安装nginx
nginx怎么添加新模块?
更多相关阅读请进入《nginx》频道 >>
转载请注明出处:木庄网络博客 » nginx使用geoip做区域限制