Package 'nginx-mod-http-lua' breaks nginx
Recent versions of nginx-mod-http-lua
have broken nginx
with the default configuration. There has been much
activity on this
package lately, and therefore it is not easy to pinpoint the breaking
change.
A related
discussion
has determined that one must add lua\_load\_resty\_core
off;
to the nginx configuration.
I have tested this issue on Alpine 3.8 and 3.9 as of 2019-05-19.
To Reproduce:
- Launch a fresh copy of Alpine, update and upgrade.
\# apk add nginx-mod-http-lua
\# nginx
You will be greeted with something like:
nginx: [alert] 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)
nginx: [error] lua_load_resty_core failed to load the resty.core module from https://github.com/openresty/lua-resty-core; ensure you are using an OpenResty release from https://openresty.org/en/download.html (rc: 2, 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 '/usr/share/lua/common/resty/core.lua'
no file '/usr/share/lua/common/resty/core/init.lua'
no file './resty/core.so'
no file '/usr/local/lib/lua/5.1/resty/core.so'
no file '/usr/lib/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/lib/lua/5.1/resty.so'
no file '/usr/local/lib/lua/5.1/loadall.so')
nginx: [emerg] open() "/run/nginx/nginx.pid" failed (2: No such file or directory)
One might think we need to install OpenResty:
\# apk add $(apk search resty | awk
F’[]’ ‘{print $1
“-” $2 “-” $3}’)
This does not resolve the issue. It appears that we need
lua-resty-core
, but this is not packaged on Alpine at this
time.
Possible Workaround:
If we instead add lua\_load\_resty\_core off;
to the nginx
http { }
configuration, we still get the OpenResty warning
above, but not the missing libraries, and nginx starts as expected.
A better solution would be to fix the package. This type of issue catches system administrators by surprise and can be incredibly frustrating.
ZV
(from redmine: issue id 10478, created on 2019-05-21)