ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

OpenResty配置WAF功能踩坑记录

2021-05-08 19:00:02  阅读:667  来源: 互联网

标签:core resty OpenResty 记录 WAF usr openresty file local


图文教程请见: https://www.lixdx.cn/2021/05/04/nginx1/

waf的配置采用大神的github的方案:[链接 https://github.com/unixhot/waf](https://www.lixdx.cn/2021/05/04/nginx1/)

但是在部署到openresty的时候出现了如下的报错,无脑的在网上找到一篇文章,按照网上的说法配置了软简介都是无效的的,
最后发现还是得自己动脑子呀,还是得靠自己。

上面提到的文章链接为:https://blog.csdn.net/kabcko/article/details/106434236 访问量还不小

openrestu waf

openrestu waf

2021/05/04 11:05:07 [alert] 2030#2030: failed to load the ‘resty.core’ module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://openresty.org/en/download.html (reason: module ‘resty.core’ not found:
no field package.preload[‘resty.core’]
no file ‘/usr/local/openresty/nginx/conf/waf/resty/core.lua’
no file ‘/usr/local/openresty/site/lualib/resty/core.so’
no file ‘/usr/local/openresty/lualib/resty/core.so’

我们仔细看这段报错发现是没有resty.core文件。
我们看下/usr/local/openresty/nginx/conf/waf/路径下到底有没有这个core.lua
查了一下果然是没有的,唉,问题应该就是这里了,接下来就是增加一个resy的软链接。

[root@lixdx conf]# ll waf/
总用量 24
-rw-r–r– 1 root root 408 5月 4 11:10 access.lua
-rw-r–r– 1 root root 1279 5月 4 11:10 config.lua
-rw-r–r– 1 root root 5473 5月 4 11:10 init.lua
-rw-r–r– 1 root root 2253 5月 4 11:10 lib.lua
lrwxrwxrwx 1 root root 34 5月 4 11:11 resty -> /usr/local/openresty/lualib/resty/
drwxr-xr-x 2 root root 4096 5月 4 10:47 rule-config
[root@lixdx conf]# nginx -t
nginx: the configuration file /usr/local/openresty/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test is successful
[root@lixdx conf]# nginx -s reload
[root@lixdx conf]#

再次查看启动日志,果然没有了报错。

//添加软连接之前
2021/05/04 11:05:07 [notice] 19572#19572: signal process started
2021/05/04 11:05:07 [alert] 2030#2030: failed to load the ‘resty.core’ module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://openresty.org/en/download.html (reason: module ‘resty.core’ not found:
no field package.preload[‘resty.core’]
no file ‘/usr/local/openresty/nginx/conf/waf/resty/core.lua’
no file ‘/usr/local/openresty/site/lualib/resty/core.so’
no file ‘/usr/local/openresty/lualib/resty/core.so’
no file ‘./resty/core.so’
no file ‘/usr/local/lib/lua/5.1/resty/core.so’
no file ‘/usr/local/openresty/luajit/lib/lua/5.1/resty/core.so’
no file ‘/usr/local/lib/lua/5.1/loadall.so’
no file ‘/usr/local/openresty/site/lualib/resty.so’
no file ‘/usr/local/openresty/lualib/resty.so’
no file ‘./resty.so’
no file ‘/usr/local/lib/lua/5.1/resty.so’
no file ‘/usr/local/openresty/luajit/lib/lua/5.1/resty.so’
no file ‘/usr/local/lib/lua/5.1/loadall.so’) in /usr/local/openresty/nginx/conf/nginx.conf:125

//添加软连接之后

2021/05/04 11:12:29 [notice] 29514#29514: signal process started

接下来在网站上进行完全测试:
果然大功告成,记下来就是将日志安全日志接入ELK了。
下一篇文章分享。

标签:core,resty,OpenResty,记录,WAF,usr,openresty,file,local
来源: https://blog.csdn.net/qq_21996843/article/details/116538694

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有