Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

duplicate geoip variable #92

Closed
cortex3 opened this issue Nov 17, 2020 · 1 comment
Closed

duplicate geoip variable #92

cortex3 opened this issue Nov 17, 2020 · 1 comment

Comments

@cortex3
Copy link

cortex3 commented Nov 17, 2020

Hi, I'm a little lost here.
I switched from nginx plus with geoip2 to a self compiled nginx with geoip2.
The config stayed the same but now I'm receiving the following error:

[root@approuter-stg-01 ~]# nginx -t
nginx: [emerg] the duplicate "geoip_country_code" variable in /etc/nginx/nginx.conf:106
nginx: configuration file /etc/nginx/nginx.conf test failed

This is the code it is referring to in the error:

  geoip2 /usr/share/GeoIP/GeoLite2-Country.mmdb {
        auto_reload  1h;
        $geoip_country_code  country  iso_code;
        $geoip_country_name  country  names  en;
    }

If i remove the country_code line it will produce the same error for the country_name line.
The file exists and geoip2 was installed properly.

packages:

[root@approuter-stg-01 ~]# yum list installed | grep -e max -e geo
geoipupdate.x86_64               4.5.0-1                    @/geoipupdate_4.5.0_linux_amd64HF4dad
libmaxminddb.x86_64              1.2.0-6.el7                @centos_7-base-x86_64

nginx:

[root@approuter-stg-01 ~]# nginx -V
nginx version: nginx/1.19.4
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC)
built with OpenSSL 1.1.1h  22 Sep 2020
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=apache --group=apache --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-openssl=/builddir/build/BUILD/openssl-OpenSSL_1_1_1h --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_geoip_module --add-module=/builddir/build/BUILD/headers-more-nginx-module-0.33 --add-module=/builddir/build/BUILD/ngx_devel_kit-0.3.0 --add-module=/builddir/build/BUILD/ngx_http_enhanced_memcached_module-0.3 --add-module=/builddir/build/BUILD/set-misc-nginx-module-0.32 --add-module=/builddir/build/BUILD/ngx_http_geoip2_module-3.3 --add-module=/builddir/build/BUILD/lua-nginx-module-0.10.19 --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie -Wl,-rpath,/usr/local/lib'

I can reproduce the error on a fresh centos 7 system with the same package and the default config (+ the geoip config)

[root@freshsystem ~]# nginx -t
nginx: [emerg] the duplicate "geoip_country_code" variable in /etc/nginx/nginx.conf:23
nginx: configuration file /etc/nginx/nginx.conf test failed

To compile my rpm I used Version 3.3. of your module and libmaxminddb-1.4.3.

It would be fantastic if you could give me any pointers here, since I have no idea how to debug this further.

@leev
Copy link
Owner

leev commented Nov 17, 2020

You're compiling in both the geoip and geoip2 modules. The geoip module already reserved geoip_country_code, so you can't use that for geoip2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants