【采坑】nginx openrestry waf防火墙搭建调试,nginxopenrestry


一、背景

二、步骤

1.安装环境依赖
yum install openssl-devel pcre-devel gcc -y
2.编译安装Openresty(Orange依赖)
wget https://openresty.org/download/openresty-1.11.2.3.tar.gz ##版本号可登陆网站自选
##编译安装
./configure -j2 --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module
gmake && gmake install

##默认安装目录
/usr/local/openresty

##配置环境变量
PATH=$PATH:$HOME/bin:/usr/local/openresty/bin:/usr/local/openresty/nginx/sbin

##生效
source /etc/profile
3.编译安装lor框架(Orange依赖)
git clone https://github.com/sumory/lor.git
cd lor && make install

##默认安装目录为:/usr/local/lor
##可执行文件:/usr/local/bin/lord
4.安装Orange
git clone https://github.com/sumory/orange.git
cd orange && make install 

##netstat -tlunp 查看9999端口是否开启
通过http://xxx:9999/访问

5.开启账号/密码访问
##auth false改成true
"auth": true

#重启orange即可
orange restart

6.安装waf插件
git clone https://github.com/unixhot/waf.git
cd waf/waf && ls
access.lua  config.lua  init.lua  lib.lua  rule-config

##/usr/local/openresty/nginx/conf/nginx.conf 添加如下配置,如下图
lua_shared_dict limit 50m; 
lua_package_path "/usr/local/openresty/nginx/conf/waf/?.lua"; 
init_by_lua_file "/usr/local/openresty/nginx/conf/waf/init.lua"; 
access_by_lua_file "/usr/local/openresty/nginx/conf/waf/access.lua";

##由以上配置可知,waf配置路径位于/usr/local/openresty/nginx/conf/waf/
cd waf/waf/ && cp * /usr/local/openresty/nginx/conf/waf/
##将配置拷贝到相应目录
7.重启orange
orange restart

三、问题总结

相关内容

    暂无相关文章