www-servers/nginx: add lua config if USE="nginx_modules_http_lua"

Start from commit
60736e686a
'resty.core' is now mandatorily loaded, and the 'lua_load_resty_core'
directive is deprecated. See also https://github.com/openresty/lua-nginx-module/pull/1501

If nginx is built with USE="nginx_modules_http_lua", there must have
resty.core (OpenResty or a module named 'resty') exist, otherwise nginx
will fail to start w/ messages like bellow:

  nginx: [alert] 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-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 '/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:47

Closes: https://bugs.gentoo.org/726728
Signed-off-by: Z. Liu <zhixu.liu@gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/39823
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Z. Liu
2024-12-23 11:56:54 +08:00
committed by Sam James
parent 125bb98bc8
commit 7ac2835a3f
2 changed files with 8 additions and 0 deletions

View File

@@ -67,4 +67,6 @@ http {
# root /var/www/localhost/htdocs;
#}
include /etc/nginx/*_vhost.conf;
}

View File

@@ -808,6 +808,12 @@ src_install() {
if use nginx_modules_http_lua; then
docinto ${HTTP_LUA_MODULE_P}
dodoc "${HTTP_LUA_MODULE_WD}"/README.markdown
insinto /etc/nginx
newins - 00-config.lua_vhost.conf <<-EOF
lua_package_path "/etc/nginx/?.lua;;";
EOF
insinto /etc/nginx/resty
touch "${ED}"/etc/nginx/resty/core.lua
fi
if use nginx_modules_http_auth_pam; then