Project

General

Profile

Bug #10478

Package 'nginx-mod-http-lua' breaks nginx

Added by Zach van Rijn about 1 month ago.

Status:
New
Priority:
High
Assignee:
Category:
Aports
Target version:
-
Start date:
05/21/2019
Due date:
% Done:

0%

Estimated time:
1.00 h
Affected versions:
Security IDs:

Description

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:

  1. Launch a fresh copy of Alpine, update and upgrade.
  2. # apk add nginx-mod-http-lua
  3. # 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

Also available in: Atom PDF