Nginx+openwaf,加nginx反向代理配置,实现防火墙功能

一、找到压缩包进行编译安装:
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白名单

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值