Sample code:
aes = require "resty.aes" aes_128_cbc_md5 = aes:new("AKeyForAES")
Check log: tail /var/log/nginx/error.log
2022/04/12 02:12:33 [error] 168091#168091: init_by_lua error: /usr/local/share/lua/5.1/resty/aes.lua:170: /usr/local/lib/libluajit-5.1.so.2: undefined symbol: EVP_CIPHER_CTX_init stack traceback: [C]: in function '__index' /usr/local/share/lua/5.1/resty/aes.lua:170: in function 'new' init_by_lua:40: in main chunk
Reason: lua-resty-string
v0.15 remove EVP_CIPHER_CTX_init
Check here
Check version in file: /usr/local/share/lua/5.1/resty/string.lua
local _M = { _VERSION = '0.09' }
lua-resty-string Version 0.09
You must update to version >= 0.15
Fix
Step 1: Remove version 0.09: luarocks remove lua-resty-string
root@tutorialspots1:~# luarocks remove lua-resty-string Checking stability of dependencies in the absence of lua-resty-string 0.09-0... Removing lua-resty-string 0.09-0... Removal successful.
Step 2:
git clone https://github.com/openresty/lua-resty-string.git
cd lua-resty-string
Step 3 (optinal):
git tag -l
root@tutorialspots1:~/lua-resty-string# git tag -l v0.01 v0.02 v0.03 v0.04 v0.05 v0.06 v0.07 v0.08 v0.09 v0.10 v0.10rc1 v0.11 v0.11rc1 v0.12 v0.12rc1 v0.13 v0.13rc1 v0.14 v0.14rc1 v0.15
You can change version by tag:
git checkout tags/<tag_name>
Example: git checkout tags/v0.15
Step 4: copy files
cp lib/resty/* /usr/local/lib/lua/resty
Done