Bug #10478

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

Added by Zach van Rijn about 1 month ago.

Target version:
Start date:
Due date:
% Done:


Estimated time:
1.00 h
Affected versions:
Security IDs:


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 for OpenResty's LuaJIT or, even better, consider using the OpenResty releases from
nginx: [error] lua_load_resty_core failed to load the resty.core module from; ensure you are using an OpenResty release from (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/'
        no file '/usr/local/lib/lua/5.1/resty/'
        no file '/usr/lib/lua/5.1/resty/'
        no file '/usr/local/lib/lua/5.1/'
        no file './'
        no file '/usr/local/lib/lua/5.1/'
        no file '/usr/lib/lua/5.1/'
        no file '/usr/local/lib/lua/5.1/')
nginx: [emerg] open() "/run/nginx/" 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.


Also available in: Atom PDF