Closed dzmitry-kankalovich closed 8 months ago
Also tried to borrow elements of Dockerfile and combine with mine, mostly around build flags:
ARG NGINX_VERSION=1.24
FROM nginx:${NGINX_VERSION}
RUN apt-get update && apt-get install -y \
curl \
gcc \
libc-dev \
make \
libpcre3-dev \
zlib1g-dev \
libssl-dev \
libjansson-dev \
libjwt-dev \
libjansson4 \
libjwt0 \
pkg-config
RUN curl -fSL https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz -o nginx.tar.gz
RUN tar -zxf nginx.tar.gz && mv nginx-${NGINX_VERSION} nginx
RUN curl -fSL https://github.com/TeslaGov/ngx-http-auth-jwt-module/archive/master.tar.gz -o ngx-http-auth-jwt-module.tar.gz
RUN tar -zxf ngx-http-auth-jwt-module.tar.gz
RUN mv /ngx-http-auth-jwt-module-master/ /ngx-http-auth-jwt-module/
RUN <<`
BUILD_FLAGS=''
MAJ=$(echo ${NGINX_VERSION} | cut -f1 -d.)
MIN=$(echo ${NGINX_VERSION} | cut -f2 -d.)
REV=$(echo ${NGINX_VERSION} | cut -f3 -d.)
# NGINX 1.23.0+ changes cookies to use a linked list, and renames `cookies` to `cookie`
if [ "${MAJ}" -gt 1 ] || [ "${MAJ}" -eq 1 -a "${MIN}" -ge 23 ]; then
BUILD_FLAGS="${BUILD_FLAGS} --with-cc-opt='-DNGX_LINKED_LIST_COOKIES=1'"
fi
cd nginx
./configure --with-compat --add-dynamic-module=../ngx-http-auth-jwt-module ${BUILD_FLAGS}
make modules
`
RUN cp /nginx/objs/ngx_http_auth_jwt_module.so /usr/lib/nginx/modules/
RUN mkdir -p /etc/nginx/modules-enabled/
RUN echo "load_module modules/ngx_http_auth_jwt_module.so;" > /etc/nginx/modules-enabled/50-mod-http-auth-jwt.conf
COPY nginx.conf /etc/nginx/nginx.conf
EXPOSE 80 443
same error 2024/01/14 14:39:00 [emerg] 7#7: unknown directive "auth_jwt" in /etc/nginx/nginx.conf:34
UPDATE: found the culprit. This is the last time I rely on AI code assistance to generate config files.
Basically my nginx.conf
contained look-alike JWT directives, but not exactly. I've checked agains test.conf and came up with valid configuration.
Sorry for the noise.
Most likely those JWT directives were NGINX's version (paid). Glad you got it working!
Hello,
I am using my
M1 Mac
to build nginx with jwt module + I intend to deploy that image toARM-based
VM.Anyway, the problem is that no matter what I try - build from the sources or inject compiled module - none of it works.
I've tried to pull in compiled module:
Gives me
However, if I ssh to that container - I can verify that the file is present and seemingly accessible.
Then I've tried to compile the thing:
Same error:
with
nginx.conf
:This time the module is seemingly loaded (no error at least), but I get another error:
as if no module loaded?
At this point I am pulling out my hair trying to understand what is going on, but no luck.
Maybe you can spot what is the problem?