网站管理waf出现Bug

当前版本:1.10.5-lts

升级成1.10.5-lts并同时升级openresty为最新版后网站管理出现bug,暂停和启动网站时出现以下错误:

服务内部错误: stderr: 2024/04/19 22:09:54 [emerg] 49#49: open() "/usr/local/openresty/1pwaf/data/conf/waf.conf" failed (2: No such file or directory) in /usr/local/openresty/nginx/conf/nginx.conf:34 nginx: [emerg] open() "/usr/local/openresty/1pwaf/data/conf/waf.conf" failed (2: No such file or directory) in /usr/local/openresty/nginx/conf/nginx.conf:34 nginx: configuration file /usr/local/openresty/nginx/conf/nginx.conf test failed

经过排查后发现容器并没有将/opt/1panel/apps/openresty/OpenResty/1pwaf挂载在/usr/local/openresty/1pwaf这个目录,导致无法读取这两个文件。

手动挂载后出现nginx: [emerg] lua_shared_dict "waf_req_count" is already defined as "waf_req_count" in /usr/local/openresty/1pwaf/data/conf/waf.conf:1 2024/04/19 22:20:20 [emerg] 1#1: lua_shared_dict "waf_req_count" is already defined as "waf_req_count" in /usr/local/openresty/1pwaf/data/conf/waf.conf:1

删除挂载后又出现nginx: [emerg] open() "/usr/local/openresty/1pwaf/data/conf/waf.conf" failed (2: No such file or directory) in /usr/local/openresty/nginx/conf/nginx.conf:34 2024/04/19 22:23:34 [emerg] 1#1: open() "/usr/local/openresty/1pwaf/data/conf/waf.conf" failed (2: No such file or directory) in /usr/local/openresty/nginx/conf/nginx.conf:34 nginx: [emerg] open() "/usr/local/openresty/1pwaf/data/conf/waf.conf" failed (2: No such file or directory) in /usr/local/openresty/nginx/conf/nginx.conf:34

并且之前发现旧的容器在经过某些有break change的镜像升级后设置依然为旧版应用的设置,而没有改为新版设置(例如gitea的GITEA__database__HOST环境变量)

可是这里是面板和OpenResty同时升级的,因该不会是这个原因吧

现在已经无法启动了。。。麻了(不过好在有备份)

看着是站点waf配置丢失的,,,要不试试关掉对应站点的waf先

现在容器一直是重启中,waf总开关已失效?提示服务内部错误: stderr: Error response from daemon: Container 0f7faa1be2dad722130bc9290bb4c4a89ce7d8c33591319ff1c769c16d6d291a is restarting, wait until the container is running

你看看最新版的高级功能里面的waf,是否能初始化,点击一下

高级功能里的waf之前1panel和openresty升级完成后我就点了初始化,但是弹出了错误,大致意思也是缺少文件,不过我一刷新就又能进waf了,现在临时用备份恢复,等待后续了。

确认一下你的镜像是否存在
1panel/openresty:1.21.4.3-2-1-focal
没有的话 docker pull 一下
然后重建 OpenResty