一、安装LUA
官方网站:https://github.com/openresty/lua-nginx-module
1、LuaJIT
wget http://luajit.org/download/LuaJIT-2.0.2.tar.gz
make install PREFIX=/usr/local/luajit
vim /etc/profile
export LUAJIT_LIB=/usr/local/luajit/lib
export LUAJIT_INC=/usr/local/luajit/include/luajit-2.0
source /etc/profile
2、ngx_devel_kit和lua-nginx-module
cd /opt/download
wget https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz
tar -xzvf v0.3.0.tar.gz
wget https://github.com/openresty/lua-nginx-module/archive/v0.10.9rc7.tar.gz
tar -xzvf v0.10.8.tar.gz
3、重新编译编译Nginx
cd /opt/download
wget http://nginx.org/download/nginx-1.12.1.tar.gz
执行解压,后按照如下方式编译:
./configure --prefix=/usr/local/nginx --add-module=/developer/soft/fastdfs-nginx-module-master/src --add-module=/usr/local/ngx_devel_kit-0.3.0 --add-module=/usr/local/lua-nginx-module-0.10.9rc7 && make && make install
ln -s /usr/local/lib/libluajit-5.1.so.2 /lib64/libluajit-5.1.so.2
4.重新启动nginx
./nginx -s reload
5.查看是否有效:
curl http://xxxx/test.php?id=../etc/passwd
github ngx_lua_waf地址:https://github.com/loveshell/ngx_lua_waf
|
请发表评论