Learn about Centmin Mod LEMP Stack today
Register Now

123.07beta21 Nginx GeoIP and Passenger detection on Centmin Mod Nginx upgrades

Discussion in 'Bug Reports' started by eva2000, Jun 19, 2014.

  1. eva2000

    eva2000 Administrator Staff Member

    53,148
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    6:06 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Bug outlined on official Github issues tracker https://github.com/centminmod/centminmod/issues/29

    Need to add Nginx GeoIP and Passenger detection on Centmin Mod Nginx upgrades. Just ran into the bug on the forum's install as Centmin Mod Nginx centmin.sh has enabled Nginx GeoIP support.

    Code:
    NGINX_GEOIP=y 
    But when I updated the .07 beta 21 files and updated centmin.sh, it had NGINX_GEOIP=n set by default. So when I upgraded Nginx via menu option 4, it caused some downtime on the forums as there was no Nginx GeoIP module support.


    Going to have to add a detection routine in for Nginx upgrade menu option 4 which will check to see if existing Nginx web server has Nginx GeoIP and/or Phusion Passenger module for Nginx compiled in.
     
  2. eva2000

    eva2000 Administrator Staff Member

    53,148
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    6:06 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Forum's current Nginx configuration

     
  3. eva2000

    eva2000 Administrator Staff Member

    53,148
    12,110
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,645
    Local Time:
    6:06 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Came up with a function (checkgeoip) to check if existing Nginx server has GeoIP module compiled in and if it does and NGINX_GEOIP=n is set in updated centmin.sh, on Nginx upgrade via menu option 4, a message prompt will come up asking if you want to continue with Nginx upgrade with NGINX_GEOIP=y or n.

    Code:
    checkgeoip() {
        GEOIP_CHECK=$(nginx -V 2>&1 | grep geoip)
    
        if [[ ! -z "$GEOIP_CHECK" ]]; then
            cecho "Detected existing Nginx has NGINX_GEOIP=y enabled" $boldyellow
            cecho "however, you are recompiling Nginx with NGINX_GEOIP=n" $boldyellow
            cecho "Is this incorrect and you want to set NGINX_GEOIP=y enabled ? " $boldyellow
            read -ep "Answer y or n. Typing y will set NGINX_GEOIP=y [y/n]: " setgeoip
            if [[ "$setgeoip" = [yY] ]]; then
                NGINX_GEOIP=y
            fi
        fi
    }
    
    detect_geoip.png

    Haven't done anything for Phusion Passenger detection yet. Will do later.