karljohns0n / nginx-more

Development repository for nginx-more package
MIT License
120 stars 29 forks source link

ngx_http_geoip2_module #1

Closed aibosss closed 5 years ago

aibosss commented 5 years ago

I love your nginx-more :)

However, each updates, I have to go and recompile this module https://github.com/leev/ngx_http_geoip2_module with the new nginx version to be able to add it to your packages.

Would you mind adding it by default? I'm sure many people would benefit as it's required to play with MaxMind Geoip2 new formats

Thanks ! :)

karljohns0n commented 5 years ago

Hi,

This module depends on libmaxminddb so I would need to build this lib as well because I don't want to rely on other repository such as EPEL to install nginx-more. Let me see what I can do!

Karl

aibosss commented 5 years ago

Great, I'm sure you'll find a way:)

Nginx geoip is really useful. However geoip2 is often needed now=)

On Mon, Dec 3, 2018, 16:46 Karl Johnson <notifications@github.com wrote:

Hi,

This module depends on libmaxminddb so I would need to build this lib as well because I don't want to rely on other repository such as EPEL to install nginx-more. Let me see what I can do!

Karl

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/karljohns0n/nginx-more/issues/1#issuecomment-443882305, or mute the thread https://github.com/notifications/unsubscribe-auth/AlaETm8qQOtKIrW-ftvhdD78eJGZUEH5ks5u1ZungaJpZM4Y9jT1 .

karljohns0n commented 5 years ago

So I went ahead and built latest libmaxminddb-1.3.2 for el6 and el7. It's now in the testing repository. I built a new version of nginx-more based on this lib and module ngx_http_geoip2_module-3.2:

yum --enablerepo=aeris-testing install https://repo.aerisnetwork.com/archive/nginx-more-1.14.2-2.el7.x86_64.rpm
[root@devkarl etc]# nginx -V
nginx version: nginx/1.14.2
custom build maintained on github.com/karljohns0n/nginx-more
built by gcc 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC) 
built with OpenSSL 1.1.1a  20 Nov 2018
TLS SNI support enabled
configure arguments: --prefix=/usr/share/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 --http-client-body-temp-path=/var/lib/nginx/cache/client_body --http-proxy-temp-path=/var/lib/nginx/cache/proxy --http-fastcgi-temp-path=/var/lib/nginx/cache/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/cache/uwsgi --http-scgi-temp-path=/var/lib/nginx/cache/scgi --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --user=nginx --group=nginx --with-compat --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_image_filter_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_geoip_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_stub_status_module --with-http_auth_request_module --with-http_xslt_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-threads --with-stream --with-stream_ssl_module --with-stream_realip_module --with-http_slice_module --with-stream_ssl_preread_module --with-debug --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 -DTCP_FASTOPEN=23' --with-cc=/opt/rh/devtoolset-7/root/usr/bin/gcc --with-openssl=modules/openssl-1.1.1a --add-module=modules/ngx_headers_more-0.33 --add-module=modules/ngx_cache_purge-2.3 --add-module=modules/ngx_module_vts-0.1.18 --add-module=modules/ngx_pagespeed-1.13.35.2-stable --add-module=modules/ngx_brotli-snap20180222 --add-module=modules/ngx_http_geoip2_module-3.2

I did some basic testing, showing my city & country name in headers:

geoip2 /etc/GeoLite2-Country.mmdb {
    auto_reload 5m;
    $geoip2_metadata_country_build metadata build_epoch;
    $geoip2_data_country_code default=US country iso_code;
    $geoip2_data_country_name country names en;
}

geoip2 /etc/GeoLite2-City.mmdb {
    auto_reload 5m;
    $geoip2_metadata_city_build metadata build_epoch;
    $geoip2_data_city_name default=Montreal city names en;
}

add_header X-Country $geoip2_data_country_name;
add_header X-City $geoip2_data_city_name;

Headers:

X-Country: Canada
X-City: Montreal

It works fine on my side. Can you provide feedbacks?

Karl

karljohns0n commented 5 years ago

Now released in the testing repository as of nginx-more-1.14.2-2, see commit 3a36521.

#> yum --enablerepo=aeris-testing update nginx-more