资讯

展开

Openresty 配置 waf

作者:快盘下载 人气:

安装openresty

cd /usr/local
mkdir openresty
cd openresty
wget https://openresty.org/download/openresty-1.21.4.1.tar.gz
tar -xvf openresty-1.21.4.1.tar.gz
yum install readline-devel pcre-devel openssl-devel gcc
cd openresty-1.21.4.1
./configure --prefix=/usr/local/openresty/server --with-luajit --with-http_stub_status_module --with-pcre --with-pcre-jit --with-http_gzip_static_module --with-http_ssl_module
gmake && gmake install
cd ../server/
./nginx/sbin/nginx

配置waf

cd /usr/local/openresty/server/nginx/conf
git clone https://gitee.com/yanglei_xyz/ngx_lua_waf.git
mv ngx_lua_waf waf

在nginx.conf的http段添加

#WAF
lua_package_path "/usr/local/openresty/server/nginx/conf/waf/?.lua";
lua_shared_dict limit 10m;
init_by_lua_file /usr/local/openresty/server/nginx/conf/waf/init.lua;
access_by_lua_file /usr/local/openresty/server/nginx/conf/waf/waf.lua;

配置config.lua里的waf规则目录(一般在waf/conf/目录下)

RulePath = "/usr/local/openresty/server/nginx/conf/waf/wafconf/"
logdir = "/usr/local/openresty/server/nginx/logs/hack/"

添加软连接

ln -s /usr/local/openresty/server/lualib /usr/local/lib/lua
ln -s /usr/local/openresty/server/lualib/resty /usr/local/openresty/server/nginx/conf/waf/resty

重新启动openresty

cd /usr/local/openresty/server/nginx/sbin
./nginx -s reload

查看是否生效

Openresty 配置 waf



加载全部内容

相关教程
猜你喜欢
用户评论
快盘暂不提供评论功能!