使用OPM包管理器从openresty访问socket.ltn12

环境

  • Openresty 6.x

ltn12luasocket 库的一个模块。

可以使用 luarocks 包管理器安装此库。

Openresty 不推荐使用 luarocks,而是推荐使用 OPM

但是我在 OPM 中找不到任何可用的 luasocket 库或 ltn12 模块。

问题

如何使用 OPMluasocket 库中使用 ltn12 模块?

编辑(临时解决方案)

  • duhoobo/lua-resty-smtp 可在 OPM 中找到,提供了可通过 require resty.smtp.ltn12 访问的 ltn12
  • 您可以复制可用的 lib/resty/smtp/ltn12.lua 文件,别忘了更改文件中的模块名称
点赞
用户1291986
用户1291986

Luarocks是openresty支持的。它没有打包在其中,但您可以安装它来获取捆绑版本的openresty。按照此处的说明:

https://openresty.org/en/using-luarocks.html

并将/usr/local/openresty/luajit替换为您自己的openresty/luajit路径

wget http://luarocks.org/releases/luarocks-2.0.13.tar.gz
tar -xzvf luarocks-2.0.13.tar.gz
cd luarocks-2.0.13/
./configure --prefix=/usr/local/openresty/luajit \
    --with-lua=/usr/local/openresty/luajit/ \
    --lua-suffix=jit \
    --with-lua-include=/usr/local/openresty/luajit/include/luajit-2.1
make
sudo make install
2021-01-25 13:43:01