Благодарю!
Вся моя проблема была в отсутствии 2-ой строки.export LUAJIT_INC=%{_includedir}/luajit-5_1-2.1
export LUAJIT_LIB=%{_libdir}
Видимо если переопределяю LUAJIT_INC то нужно сразу и переопределить LUAJIT_LIB даже если она стандартная.
Луамодуль собрал, буду собирать lua-resty-redis.
P.S. /var/log/nginx/error.log
2024/04/19 11:21:48 [alert] 23985#23985: 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)
2024/04/19 11:21:48 [alert] 23985#23985: failed to load the 'resty.core' module (https://github.com/openresty/lua-resty-core); ensure you are using an OpenResty release from https://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/share/luajit-5_1-2.1/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 '/usr/share/lua/5.1/resty/core.lua'
no file '/usr/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/lib64/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/lib64/lua/5.1/resty.so'
no file '/usr/local/lib/lua/5.1/loadall.so') in /etc/nginx/nginx.conf:67
Ещё и lua-resty-core нужен.