OpenResty配置WAF功能踩坑记录

图文教程请见: 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了。
下一篇文章分享。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小胖东不吃肉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值