commit:     7ac2835a3fc6c319970af018f3c38752ca46e14a
Author:     Z. Liu <zhixu.liu <AT> gmail <DOT> com>
AuthorDate: Mon Dec 23 03:56:54 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Dec 23 09:37:28 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ac2835a

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

Start from commit
https://github.com/openresty/lua-nginx-module/commit/60736e686ac5ca5af9a5bf118cb9bd4a9126cefc
'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 <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/39823
Signed-off-by: Sam James <sam <AT> gentoo.org>

 www-servers/nginx/files/nginx.conf-r3                               | 2 ++
 .../nginx/{nginx-1.26.2-r7.ebuild => nginx-1.26.2-r8.ebuild}        | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/www-servers/nginx/files/nginx.conf-r3 
b/www-servers/nginx/files/nginx.conf-r3
index aedaad4f64ef..f851bbf8934e 100644
--- a/www-servers/nginx/files/nginx.conf-r3
+++ b/www-servers/nginx/files/nginx.conf-r3
@@ -67,4 +67,6 @@ http {
 
        #       root /var/www/localhost/htdocs;
        #}
+
+       include /etc/nginx/*_vhost.conf;
 }

diff --git a/www-servers/nginx/nginx-1.26.2-r7.ebuild 
b/www-servers/nginx/nginx-1.26.2-r8.ebuild
similarity index 99%
rename from www-servers/nginx/nginx-1.26.2-r7.ebuild
rename to www-servers/nginx/nginx-1.26.2-r8.ebuild
index cfc77b65badc..043eba9050b0 100644
--- a/www-servers/nginx/nginx-1.26.2-r7.ebuild
+++ b/www-servers/nginx/nginx-1.26.2-r8.ebuild
@@ -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

Reply via email to