mkdir /data/requirements
cd /data/requirements
git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module
wget https://openresty.org/download/openresty-1.13.6.2.tar.gz
tar -zxvf openresty-1.13.6.2.tar.gz
yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel
yum -y install gcc gcc-c++ autoconf automake make
cd openresty-1.13.6.2
./configure --with-http_sub_module --with-pcre-jit --with-ipv6 --add-module=/data/requirements/ngx_http_substitutions_filter_module
gmake
gmake install
geoip_country /usr/share/GeoIP/GeoIP.dat; #GeoIP 所在目录
map $geoip_country_code $allowed_country { #变量判断
default no; #允许
CN yes; #区域不允许,这个 CN 就是代表中国,如果是多个地区,就是 CN 下面加就行
}
if ($geoip_country_code != CN)
{return 403;}
yum install geoip-devel
geoiplookup /usr/share/GeoIP/GeoIP.dat 127.0.0.1
./configure --with-http_sub_module --with-pcre-jit --with-ipv6 --add-module=/data/requirements/ngx_http_substitutions_filter_module --with-http_geoip_module --with-http_v2_module
正文完