宝塔启动nginx报错:nginx: [alert] failed to load the 'resty.core' module

  1. 报错详情如下:
  2. 官方解决方案:
  3. 其他解决方案

报错详情如下:

nginx: [alert] 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 './resty/core.lua'
no file '/usr/local/share/luajit-2.1.0-beta3/resty/core.lua'
no file '/usr/local/share/lua/5.1/resty/core.lua'
no file '/usr/local/share/lua/5.1/resty/core/init.lua'
no file './resty/core.so'
no file '/usr/local/lib/lua/5.1/resty/core.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
no file './resty.so'
no file '/usr/local/lib/lua/5.1/resty.so'
no file '/usr/local/lib/lua/5.1/loadall.so') in /www/server/nginx/conf/nginx.conf:96

官方解决方案:

在nignx的配置文件中的http模块里面添加下面一行配置

lua_package_path "/www/server/nginx/lib/lua/?.lua;;";

sh2.png

其他解决方案

不要驚慌,也不要去重裝Nginx,加倆分号就能解決
去到/www/server/panel/vhost/nginx這個目錄,打開btwaf.conf這個配置文件
定位到lua_package_path這一行,後面的内容應該是”/www/server/btwaf/?.lua”,在?.lua的後面加上兩個半角分号(;;)

完成後大概是這樣:

lua_shared_dict spider 10m;
lua_shared_dict btwaf 30m;
lua_shared_dict drop_ip 30m;
lua_shared_dict drop_sum 30m;
lua_shared_dict btwaf_data 100m;
lua_package_path "/www/server/btwaf/?.lua;;";
init_by_lua_file  /www/server/btwaf/init.lua;
access_by_lua_file /www/server/btwaf/waf.lua;
header_filter_by_lua_file /www/server/btwaf/header.lua;
body_filter_by_lua_file /www/server/btwaf/body.lua;

欢迎指出任何有错误或不够清晰的表达,可以在下面评论区评论。

×

喜欢就点赞,疼爱就打赏

//