openresty 编译安装

singapore uncle 2023-09-22 00:16:19 阅读 0评论
新服务器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

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;
        }
免责声明:本站所有资源均由网络搜集用户投稿而来,若有侵权,违法违规侵权内容请联系本站并提供必要证明,本站将及时删除违法违规内容,谢谢合作!