Nginx-lua-CCDeny

nginx:http://nginx.org/download/nginx-1.17.8.tar.gz

ngx_devel_kit:https://github.com/vision5/ngx_devel_kit/archive/master.zip

lua-nginx-module:建議版本:https://github.com/openresty/lua-nginx-module/archive/v0.10.13.zip(14,15)

https://github.com/openresty/luajit2/archive/v2.1-20200102.zip

make && make install PREFIX=/usr/local/lj2

export LUAJIT_LIB=/usr/local/lj2/lib/

export LUAJIT_INC=/usr/local/lj2/include/luajit-2.1

./configure --prefix=/usr/local/nginx \
--add-module=/usr/local/src/ngx_devel_kit/ \
--add-module=/usr/local/src/lua-nginx-module/

./sbin/nginx: error while loading shared libraries: libluajit-5.1.so.2: cannot open shared object file: No such file or directory
ln -s /usr/local/lj2/lib/libluajit-5.1.so.2 /lib64/

------------------------------------------------------------------------------

ngx_lua_waf:https://github.com/loveshell/ngx_lua_waf

https://github.com/loveshell/ngx_lua_waf/archive/master.zip

mv ngx_lua_waf-master/* /usr/local/nginx/conf/waf/

在nginx.conf的http段添加;
lua_package_path "/usr/local/nginx/conf/waf/?.lua";
lua_shared_dict limit 10m;
init_by_lua_file  /usr/local/nginx/conf/waf/init.lua; 
access_by_lua_file /usr/local/nginx/conf/waf/waf.lua;

 CCDeny:vim /usr/local/nginx/conf/waf/config.lua CCDeny="on"

CCrate="100/60" # 限制60秒100個請求

yum -y install httpd-tools

ab -n 100000 -c 100 http://192.168.1.100/index.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章