Learn about Centmin Mod LEMP Stack today
Become a Member

Install unknown directive "geoip_country" error

Discussion in 'Install & Upgrades or Pre-Install Questions' started by hardousse, Mar 19, 2016.

  1. hardousse

    hardousse Active Member

    169
    35
    28
    Dec 15, 2015
    Sweden
    Ratings:
    +57
    Local Time:
    7:44 AM
    1.11.*
    10.1*
    when i install new vhost i get this error and nginx faild to restart :
    Code:
    [root@centvm2 ~]# nginx -t
    nginx: [emerg] unknown directive "geoip_country" in /usr/local/nginx/conf/geoip.conf:2
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    
    i use the last beta build centos 7.2.

     
  2. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    7:44 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    On line two i have without any issues this:

    Code:
    geoip_country /usr/share/GeoIP/GeoIP.dat;
     
  3. hardousse

    hardousse Active Member

    169
    35
    28
    Dec 15, 2015
    Sweden
    Ratings:
    +57
    Local Time:
    7:44 AM
    1.11.*
    10.1*
    me too i have the same on line 2 i dont know why i get this error this output of :
    Code:
    # SET the path to the .dat file used for determining the visitor's country from$
    geoip_country /usr/share/GeoIP/GeoIP.dat;
    
    # SET the path to the .dat file used for determining the visitor's country from$
    geoip_city /usr/share/GeoIP/GeoIPCity.dat;
    
     
  4. pamamolf

    pamamolf Premium Member Premium Member

    4,087
    428
    83
    May 31, 2014
    Ratings:
    +834
    Local Time:
    7:44 AM
    Nginx-1.25.x
    MariaDB 10.3.x
    This error indicate that your loaded binary doesn't have geoip module compiled in.
     
  5. eva2000

    eva2000 Administrator Staff Member

    54,934
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    3:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Did you disable nginx geoip module via
    Code (Text):
    NGINX_GEOIP='n'              # Nginx GEOIP module install

    set to yes
    Code (Text):
    NGINX_GEOIP='y'              # Nginx GEOIP module install

    and recompile nginx via centmin.sh menu option 4
     
  6. hardousse

    hardousse Active Member

    169
    35
    28
    Dec 15, 2015
    Sweden
    Ratings:
    +57
    Local Time:
    7:44 AM
    1.11.*
    10.1*
    i dont desable the geoip module and when i make like you said i get this error now when i use
    NGINX_GEOIP='y' and after option 4 nginx faild to compil
    Code:
    sed: can't read src/http/modules/ngx_http_geoip_module.c: No such file or directory
    grep: src/http/modules/ngx_http_geoip_module.c: No such file or directory
     
  7. eva2000

    eva2000 Administrator Staff Member

    54,934
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    3:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    To troubleshoot, you need to check the the nginx upgrade log at /root/centminlogs and instructions under Sharing logs and errors heading for using Pastebin.com or Gists to share a sanitised version of the contents of the initial install log. You can see full details at How to troubleshoot Centmin Mod initial install issues

    also what's output of
    Code:
    nginx -t
     
  8. hardousse

    hardousse Active Member

    169
    35
    28
    Dec 15, 2015
    Sweden
    Ratings:
    +57
    Local Time:
    7:44 AM
    1.11.*
    10.1*
    Code:
    [root@centvm2 ~]# nginx -t
    nginx: [emerg] unknown directive "geoip_country" in /usr/local/nginx/conf/geoip.conf:2
    nginx: configuration file /usr/local/nginx/conf/nginx.conf test failed
    
    its the same i dont know what happen i dont change nothing just after the last update nginx failed to compile
     
  9. hardousse

    hardousse Active Member

    169
    35
    28
    Dec 15, 2015
    Sweden
    Ratings:
    +57
    Local Time:
    7:44 AM
    1.11.*
    10.1*
    i check the logs and i found this :
    Code:
      / 
    Compiling nginx...
    Initializing download: http://nginx.org/download/nginx-.tar.gz
    HTTP/1.1 404 Not Found
    tar (child): nginx-.tar.gz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    inc/nginx_upgrade.inc: line 472: cd: nginx-: No such file or directory
    make: *** No rule to make target `clean'.  Stop.
    *************************************************
    Nginx Patch Time - 1 seconds delay
    to allow you to patch files
    *************************************************
      
    NGX_DYNAMICCHECK nginx_configure
    /svr-setup
    grep: /svr-setup/nginx-1.9.12/auto/options: No such file or directory
    tar (child): /svr-setup/nginx-develkit_v0.3.0rc1.tar.gz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    Cloning into 'nginx-module-vts'...
    tar (child): /svr-setup/nginx-upstream-check-0.3.0.tar.gz: Cannot open: No such file or directory
    tar (child): Error is not recoverable: exiting now
    tar: Child returned status 2
    tar: Error is not recoverable: exiting now
    /usr/lib64/libatomic_ops.a found
    sed: can't read src/http/modules/ngx_http_geoip_module.c: No such file or directory
    grep: src/http/modules/ngx_http_geoip_module.c: No such file or directory
     
  10. eva2000

    eva2000 Administrator Staff Member

    54,934
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    3:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    looks like nginx 1.9.12 download itself failed or was partially downloaded as is those listed at
    • /svr-setup/nginx-develkit_v0.3.0rc1.tar.gz
    • /svr-setup/nginx-upstream-check-0.3.0.tar.gz
    could be other downloads affected due to an issue with connectivity between your server and download source.

    You can try emptying the corrupted downloads in /svr-setup try re-downloading them all if you're using 123.09beta01
    Code (Text):
    rm -rf /svr-setup
    unzip -qo /usr/local/src/centminmod/downloads/svr-setup.zip -d /

    then re-run centmin.sh menu option 4 to recompile nginx 1.9.12

    also suggests you didn't type nginx version at the right prompt as it's empty instead of nginx-1.9.12.tar.gz
     
  11. hardousse

    hardousse Active Member

    169
    35
    28
    Dec 15, 2015
    Sweden
    Ratings:
    +57
    Local Time:
    7:44 AM
    1.11.*
    10.1*
    Problem solved:).
    Thank you for help now everything ok its was problem about Nginx download. Good work
     
  12. eva2000

    eva2000 Administrator Staff Member

    54,934
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    3:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    You're welcome. Thanks for the confirmation :)
     
  13. negative

    negative Active Member

    415
    50
    28
    Apr 11, 2015
    Ratings:
    +98
    Local Time:
    7:44 AM
    1.9.10
    10.1.11
    Btw, where we use the nginx geoip module ?
    And for what ?

    I think, xenforo doen't need that so if we run only xenforo or wordpress, we don't need it, right ?
     
  14. eva2000

    eva2000 Administrator Staff Member

    54,934
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    3:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    nginx.conf loads include file /usr/local/nginx/conf/geoip.conf which uses geoip

    with 123.09beta01 and now that geoip nginx module is loaded as nginx dynamic module, the nginx binary itself is a much smaller size compared to non-dynamic module. Honestly, you won't get significantly better performance when you're unloading geoip nginx module out of the box for nginx so best to just leave it there.

    123.09beta01 nginx config
    size of nginx binary
    Code (Text):
    ls -lah $(which nginx)
    -rwxr-xr-x 1 root root 3.1M Mar 25 08:24 /usr/local/sbin/nginx
     
    Last edited: Mar 25, 2016
  15. negative

    negative Active Member

    415
    50
    28
    Apr 11, 2015
    Ratings:
    +98
    Local Time:
    7:44 AM
    1.9.10
    10.1.11
    @eva2000 I mean that, i think i have no need the nginx geoip module on my xenforo forum, isn't it ? So i can disable it. Where uses the geoip module, and for what?
     
  16. eva2000

    eva2000 Administrator Staff Member

    54,934
    12,240
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,812
    Local Time:
    3:44 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Yeah not needed for Xenforo itself. GeoIP nginx allows you do stuff like block or rate limit country specific visitors at Nginx level. On my centminmod.com geodns latency DNS cluster of VPSes I use it to serve ads in header and sidebar area specifically to different countries' visitors. See Module ngx_http_geoip_module and another example nginx: How To Block Visitors By Country With The GeoIP Module (Debian/Ubuntu)