aapanel 屏蔽中国 IP¶
注意事项 你的 nginx 需要是编译安装而不是快速安装 如果你在安装时选择了快速安装,可以先卸载 nginx ,然后再重新安装,安装时选择编译安装 事先准备 如果你是 centos ,需要 如果你是 debian ,需要 安装过程 大部分步骤可以参考下面的文章 https://forum.aapanel.com/d/
注意事项¶
你的 nginx 需要是编译安装而不是快速安装
如果你在安装时选择了快速安装,可以先卸载 nginx,然后再重新安装,安装时选择编译安装
事先准备¶
如果你是 centos,需要
yum install libmaxminddb-devel -y
如果你是 debian,需要
apt-get install -y libmaxminddb-dev
安装过程¶
大部分步骤可以参考下面的文章 https://forum.aapanel.com/d/1015-how-to-compile-and-install-third-party-modules-in-aapanel-nginx
配置文件¶
nginx 配置,在 http 字段加入
geoip2 /www/server/nginx/GeoLite2-Country.mmdb {
$geoip2_data_country_code country iso_code;
}
map $geoip2_data_country_code $allowed_country {
default yes;
CN no;
}
网站配置
if ($allowed_country = no) {
return 403;
}