skip to Main Content

I’m trying to configure nginx to build the GeoIP2 module, by following this installation:
https://github.com/leev/ngx_http_geoip2_module

first I still didn’t understand what is defrences between static and dynamic modules,
and why can’t I just apt install that module..

The problemm is that I want to build/create it on a diffrent machine, so I had to copy the configure flags from the destination machine by copy the output of this command:

nginx -V

and then I ran this command on the test machine:

PKG_CONFIG_PATH="/usr/lib/x86_64-linux-gnu/pkgconfig/" ./configure --without-http_rewrite_module --without-http_gzip_module --add-module=/path/ngx_http_geoip2_module-3.3 (PASTE DESTINATION NGINX -V OUTPUT)
make
make install

Then after succession I copied the file name: ngx_http_geoip2_module.so to destination machine
and ran nginx -t
I got this error:

nginx: [emerg] module "/etc/nginx/modules/ngx_http_geoip2_module.so" is not binary compatible in /etc/nginx/nginx.conf
nginx: configuration file /etc/nginx/nginx.conf test failed

My destination machine:
Ubuntu 20
Nginx 1.20.1

2

Answers


  1. –with-compat –add-module=/path/to/ngx_http_geoip2_module

    or

    –with-compat –add-dynamic-module=/path/to/ngx_http_geoip2_module

    Login or Signup to reply.
  2. My solution was to add --with-compat option. Here are the commands I used to build it on Almalinux 9.1:

    git clone https://github.com/nginx/nginx.git
    git clone https://github.com/leev/ngx_http_geoip2_module.git
    cd nginx
    git checkout release-1.22.1 # or whatever version you have
    auto/configure --with-compat --with-stream --add-dynamic-module=../ngx_http_geoip2_module `nginx -V`
    make
    cp objs/ngx_http_geoip2_module.so /usr/lib64/nginx/modules/
    cp objs/ngx_stream_geoip2_module.so /usr/lib64/nginx/modules/
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search