openresty 编译安装

新服务器openresty 环境安装


mkdir /data/requirements

cd /data/requirements

git clone https://github.com/yaoweibin/ngx_http_substitutions_filter_module

git clone https://github.com/hamishforbes/lua-resty-iputils



yum -y install zlib zlib-devel openssl openssl-devel pcre pcre-devel

yum -y install gcc gcc-c++ autoconf automake make


yum install geoip-devel

wget https://openresty.org/download/openresty-1.19.9.1.tar.gz

tar -zxvf openresty-1.19.9.1.tar.gz

cd openresty-1.19.9.1



./configure --with-http_sub_module --with-pcre-jit --add-module=/data/requirements/ngx_http_substitutions_filter_module --with-http_geoip_module --with-http_v2_module

gmake && gmake install



已邀请:

qk356 - IT男有人权吗?

赞同来自:

geoiplookup /usr/share/GeoIP/GeoIP.dat 127.0.0.1

qk356 - IT男有人权吗?

赞同来自:

 ./configure  --with-http_sub_module --with-pcre-jit  --add-module=/data/requirements/ngx_http_substitutions_filter_module --with-http_geoip_module



   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;
}

要回复问题请先登录注册