luarocks: Lua 包管理工具

发布时间: 更新时间: 总字数:608 阅读时间:2m 作者:IP:上海 网址

LuaRocks 是 Lua 编程语言的程序包管理器,它提供了分发 Lua 模块的标准格式,易于管理 rock 安装的工具以及用于分发它们的服务器

国内代理

  • luarocks.cn 是国内加速网站,使用 --server https://luarocks.cn 指定国内源,示例
$ luarocks install apisix --server https://luarocks.cn
$ luarocks install kong --server https://luarocks.cn

使用

安装 lua-casbin

/usr/local/openresty/luajit/bin/luarocks install lrexlib-pcre PCRE_DIR=/usr/local/openresty/pcre
GIT_SSL_NO_VERIFY=1 /usr/local/openresty/luajit/bin/luarocks install casbin

安装 resty-http

luarocks install lua-resty-http

使用示例(现象类似于 curl --resolve 的效果):

resty-http-get-demo ...
resty-http-post-demo ...

F&Q

module ‘resty.http’ not found

luarocks install lua-resty-http

failed to load module resty.openssl.*, mTLS isn’t supported without lua-resty-openssl

luarocks install lua-resty-openssl

lua ssl certificate verify error: (20: unable to get local issuer certificate)

  • nginx.conf 中配置(参考
lua_ssl_verify_depth 2;
lua_ssl_trusted_certificate /etc/ssl/certs/ca-certificates.pem;
本文总阅读量 次 本站总访问量 次 本站总访客数