Learn about Centmin Mod LEMP Stack today
Register Now

When to expect GeoIp2 in centminmod?

Discussion in 'Feature Requests & Suggestions' started by wmtech, May 9, 2018.

Tags:
  1. eva2000

    eva2000 Administrator Staff Member

    34,253
    7,581
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,656
    Local Time:
    7:31 AM
    Nginx 1.13.x
    MariaDB 5.5
    Only issue I am struggling with is fact that nginx geoip2 module is 4yrs old with no updates or active development. I can easily control nginx side configs so when geoip2 module is disabled i also disable nginx side configs.

    But php.conf include file fastcgi_params can be spread when php.conf include files are copied/cloned in some configurations and if nginx geoip2 module is disabled, those php.conf fastcgi_param will error out preventing nginx for starting up until they are removed.

    This isn't an issue for nginx native geoip module for geoip legacy database as the module is always enabled and trusted development wise.
     
  2. wmtech

    wmtech Member

    51
    15
    8
    Jul 22, 2017
    Ratings:
    +32
    Local Time:
    11:31 PM
    You can also think about to include the city database only. All the data from the country database is available in the city database too and it saves memory if just one database is added.

    The country database should be used only if neither city or region info is needed and you want to save even more memory.
     
    • Like Like x 1
  3. wmtech

    wmtech Member

    51
    15
    8
    Jul 22, 2017
    Ratings:
    +32
    Local Time:
    11:31 PM
    I understand your concerns. Maybe there will be a new GeoIp2 module available once Nginx recognizes that legacy GeoIP is no longer available. Or the existing module will be picked up by another developer. Who knows.

    But the new database info will stay, so it will be just a matter of switching modules if anything happens.

    And the existing module works as it should, is recommended by Nginx and looks also very decent from my quick reading over the code today.
     
  4. eva2000

    eva2000 Administrator Staff Member

    34,253
    7,581
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,656
    Local Time:
    7:31 AM
    Nginx 1.13.x
    MariaDB 5.5
    Yeah for now I intend to create a separate include file /usr/local/nginx/conf/php-geoip2.conf which is same as /usr/local/nginx/conf/php.conf include just with extended GEOIP2 fastcgi_param settings included. So users can switch that manually themselves and use that instead in their nginx vhosts.

    the settings in /usr/local/nginx/conf/php-geoip2.conf
    Code (Text):
    # Set php-fpm geoip variables
    fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
    fastcgi_param GEOIP_COUNTRY_CODE3 $geoip_country_code3;
    fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE $geoip_city_country_code;
    fastcgi_param GEOIP_CITY_COUNTRY_CODE3 $geoip_city_country_code3;
    fastcgi_param GEOIP_CITY_COUNTRY_NAME $geoip_city_country_name;
    fastcgi_param GEOIP_REGION $geoip_region;
    fastcgi_param GEOIP_CITY $geoip_city;
    fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
    fastcgi_param GEOIP_CITY_CONTINENT_CODE $geoip_city_continent_code;
    fastcgi_param GEOIP_LATITUDE $geoip_latitude;
    fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
    
    fastcgi_param GEOIP2_CITY $geoip2_data_city_name;
    fastcgi_param GEOIP2_CITY_GEONAMEID $geoip2_data_city_geonameid;
    fastcgi_param GEOIP2_CONTINENT_CODE $geoip2_data_continent_code;
    fastcgi_param GEOIP2_CONTINENT_GEONAMEID $geoip2_data_continent_geonameid;
    fastcgi_param GEOIP2_CONTINENT_NAME $geoip2_data_continent_name;
    fastcgi_param GEOIP2_COUNTRY_GEONAMEID $geoip2_data_country_geonameid;
    fastcgi_param GEOIP2_COUNTRY_ISO_CODE $geoip2_data_country_iso;
    fastcgi_param GEOIP2_COUNTRY $geoip2_data_country_name;
    fastcgi_param GEOIP2_LOCATION_ACCURACY_RADIUS $geoip2_data_location_accuracyradius;
    fastcgi_param GEOIP2_LATITUDE $geoip2_data_location_latitude;
    fastcgi_param GEOIP2_LONGITUDE $geoip2_data_location_longitude;
    fastcgi_param GEOIP2_LOCATION_METROCODE $geoip2_data_location_metrocode;
    fastcgi_param GEOIP2_LOCATION_TIMEZONE $geoip2_data_location_timezone;
    fastcgi_param GEOIP2_POSTAL_CODE $geoip2_data_postal_code;
    fastcgi_param GEOIP2_REGISTERED_COUNTRY_GEONAMEID $geoip2_data_rcountry_geonameid;
    fastcgi_param GEOIP2_REGISTERED_COUNTRY_ISO $geoip2_data_rcountry_iso;
    fastcgi_param GEOIP2_REGISTERED_COUNTRY_NAME $geoip2_data_rcountry_name;
    fastcgi_param GEOIP2_REGION_GEONAMEID $geoip2_data_region_geonameid;
    fastcgi_param GEOIP2_REGION $geoip2_data_region_iso;
    fastcgi_param GEOIP2_REGION_NAME $geoip2_data_region_name;
    


    haven't updated 123.09beta01 branch with this code as yet though

    code updated at Beta Branch - add php-geoip2.conf include file variant for GeoIP2

    upload_2018-5-10_3-10-25.png
     
    • Agree Agree x 1
  5. eva2000

    eva2000 Administrator Staff Member

    34,253
    7,581
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +11,656
    Local Time:
    7:31 AM
    Nginx 1.13.x
    MariaDB 5.5
    Overlooked this post. Looks like a good plan :)

    size wise
    Code (Text):
    ls -lah /usr/share/GeoIP| grep GeoLite2
    -rw-r--r--  1 2000 2000  54M May  1 17:00 GeoLite2-City.mmdb
    -rw-r--r--  1 root root  26M May  1 17:00 GeoLite2-City.tar.gz
    -rw-r--r--  1 2000 2000 3.3M May  1 16:48 GeoLite2-Country.mmdb
    -rw-r--r--  1 root root 1.7M May  1 16:48 GeoLite2-Country.tar.gz
    
     
..