nginx-mod-http-lua needs requires working directory in /usr/lib/nginx and complains a lot
Using Alpine Linux latest (3.12) with the following Dockerfile
:
FROM alpine:latest
RUN apk --no-cache add nginx-mod-http-lua && \
mkdir -p /run/nginx
and building & serving a project in the current directory by:
docker build -t nginx-lua .
docker run --rm -it -p 80:80 -v "${PWD}":/app -w /app nginx-lua nginx -p .
fails with:
2020/07/18 11:29:10 [emerg] 1#1: dlopen() "./modules/ndk_http_module.so" failed
(Error loading shared library ./modules/ndk_http_module.so:
No such file or directory) in /etc/nginx/modules/devel_kit.conf:1
because the configuration files devel_kit.conf
and http_lua.conf
expect nginx to start in /usr/lib/nginx
. How about putting the full path to the configuration files?
load_module "/usr/lib/nginx/modules/ndk_http_module.so";
load_module "/usr/lib/nginx/modules/ngx_http_lua_module.so";
After overcoming the module loading problem, the user is intimidated by an alert and an error:
2020/07/18 12:28:07 [alert] 1#1: 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)
How about installing the LuaJIT version that openresty/lua-nginx-module recommends?
2020/07/18 12:28:07 [error] 1#1: 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')
A simple example using ngx.say
works, but the error does not look well. How about including the resty.core
module in the package?