一、找到压缩包进行编译安装:
tar -zxv -f openresty-1.15.8.1.tar.gz
cd openresty-1.15.8.1
./configure --with-luajit --with-http_stub_status_module --with-pcre --with-pcre-jit
gmake && gmake install
二、为了测试openresty是否成功安装,在nginx的配置文件加入
server {
location /hello {
default_type text/html;
content_by_lua_block {
ngx.say(“HelloWorld”)
}
}
}
保存退出,访问ip/hello,出现HelloWorld证明安装成功。
三、接下来部署WAF
在github里找waf的压缩包,解压后移动到/usr/local/openresty/nginx/conf/
cp -a ./waf/waf /usr/local/openresty/nginx/conf/
也可以从github克隆waf
git clone https://github.com/unixhot/waf.git
cp -a ./waf/waf /usr/local/openresty/nginx/conf/
这个是waf目录:/usr/local/openresty/nginx/conf/waf
lua配置文件:/usr/local/openresty/nginx/conf/waf/config.lua
Waf的ip黑名单:/usr/local/openresty/nginx/conf/waf/rule-config/blackip.rule
Waf的ip白名单