*** For CentOS 6 – 64-bit ***
# rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# yum install geoip geoip-devel
#vi /etc/nginx/conf/nginx.conf
http {
[...]
geoip_country /usr/share/GeoIP/GeoIP.dat;
map $geoip_country_code $allowed_country {
default yes;
CN no;
}
[...]
}
#vi /etc/nginx/conf.d/yourdomain.conf
server {
[...]
if ($allowed_country = no) {
return 403;
}
[...]
}
# yum remove nginx
# yum install nginx-1.0.15
歡迎光臨 ADJ網路實驗室 (http://dz.adj.idv.tw/) | Powered by Discuz! 6.0.0 |