我想将 openrestys lua-nginx-module 安装到我的 Nginx 安装中。我尝试了以下步骤
https://github.com/openresty/lua-nginx-module
和
https://stackoverflow.com/questions/50357732/adding-lua-module-to-nginx
我完成了上述步骤,当我启动 Nginx 服务器时,出现以下错误
[ec2-user@ip-172-31-39-216 conf.d]$
[ec2-user@ip-172-31-39-216 conf.d]$ sudo service nginx start
Starting nginx: nginx: [alert] detected a LuaJIT version which is not OpenResty's; many optimizations will be disabled and performance will be compromised (see https://github.com/openresty/luajit2 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from https://openresty.org/en/download.html)
nginx: [error] lua_load_resty_core failed to load the resty.core module from https://github.com/openresty/lua-resty-core; ensure you are using an OpenResty release from https://openresty.org/en/download.html (rc: 2, reason: module 'resty.core' not found:
no field package.preload['resty.core']
no file '../lua-resty-core/lib/resty/core.lua'
no file '../lua-resty-lrucache/lib/resty/core.lua'
no file './resty/core.lua'
no file '/usr/local/share/luajit-2.0.5/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')
[ OK ]
[ec2-user@ip-172-31-39-216 conf.d]$
[ec2-user@ip-172-31-39-216 conf.d]$
警报部分很好,但我担心错误。
我是否需要进行一些额外的配置。
就我而言,我无法安装 openresty 而不是 Nginx。
我尝试将其添加为动态模块。我甚至尝试添加模块并编译 Nginx。问题仍然相同。
提前致谢
答案1
当我们在 nginx.conf 中将 lua_load_resty_core 选项设置为 off 时,错误就消失了
lua_load_resty_core off
参考:
https://github.com/openresty/lua-nginx-module/issues/1509