报错信息:
nginx: [alert] failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from 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 /usr/local/nginx/conf/nginx.conf:222
原因分析:
找不到lualib库和resty模块,默认到/usr/local/lib/ 去找lualib,然而在编译安装OpenResty时lualib库默认放到/usr/local/openresty/lualib
$ ln -s /usr/local/openresty/lualib /usr/local/lib/lua $ ln -s /usr/local/openresty/lualib/resty /usr/local/lib
如果是之前已配置“ln -s /usr/local/openresty/lualib/resty /usr/local/lib”,本次执行“/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf”仍报上述错误,则删除已有的软连接,重新执行“ln -s /usr/local/openresty/lualib/resty /usr/local/lib”
即:
# cd /usr/local/lib
# ls
libluajit-5.1.a libluajit-5.1.so libluajit-5.1.so.2 libluajit-5.1.so.2.1.0 lua pkgconfig resty
# rm -rf ./resty
# ln -s /usr/local/openresty/lualib/resty /usr/local/lib
# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

2121

被折叠的 条评论
为什么被折叠?



