openresty / headers-more-nginx-module

Set, add, and clear arbitrary output headers in NGINX http servers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"/etc/nginx/modules/ngx_http_headers_more_filter_module.so" is not binary compatible

adimaryadi opened this issue · comments

Anyone know why it's not compatible?
I use nginx version: nginx/1.17.8

@adimaryadi because you have to compile with a matching version and with --with-compat configure flag.

@dvershinin I came across this "not binary compatible" error while using Nginx 1.22. I suspect the compiler flags used for the Alpine distribution differ from the flags that the Nginx team uses for the official docker image. The nginx:stable-alpine Docker image, which is based on Nginx 1.22.0-r1 and almost matches the 1.22.0-r2 version shown in the nginx-mod-http-headers-more Alpine package. Here's a minimal reproducible example:

FROM docker.io/nginx:stable-alpine
RUN apk add --no-cache \
    nginx-mod-http-headers-more
RUN echo "load_module /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so;" > /etc/nginx/nginx.conf

Error message:

nginx: [emerg] module "/usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so" is not binary compatible in /etc/nginx/nginx.conf

I can work around the issue by using the nginx Alpine package, which is built by the same person who maintains the Alpine package for this repo.

FROM alpine:3.16
RUN apk add --no-cache \
    nginx \
    nginx-mod-http-headers-more
RUN echo "load_module /usr/lib/nginx/modules/ngx_http_headers_more_filter_module.so;" > /etc/nginx/nginx.conf
ENTRYPOINT [ "nginx" ]

I'm not sure if OP's issue is the same as mine because he didn't mention Alpine and is using nginx 1.17.8.

@adimaryadi i bet the output of your nginx -V is missing --with-compat. you'll need an nginx binary that was compiled with that flag.

You need to compile third party modules on your own for official Nginx Docker images nginxinc/docker-nginx#364 (comment)