OpenResty配置WAF功能踩坑记录
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了OpenResty配置WAF功能踩坑记录,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3015字,纯文字阅读大概需要5分钟。
内容图文
图文教程请见: 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了。
下一篇文章分享。
内容总结
以上是互联网集市为您收集整理的OpenResty配置WAF功能踩坑记录全部内容,希望文章能够帮你解决OpenResty配置WAF功能踩坑记录所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。