Discover Centmin Mod today
Register Now

Worldwide static files

Discussion in 'System Administration' started by inthecloudblog, Oct 29, 2017.

  1. inthecloudblog

    inthecloudblog Active Member

    191
    36
    28
    Jan 26, 2016
    Ratings:
    +81
    Local Time:
    12:37 AM
    1.4.6
    Hi . Want to make use of a vast number of servers I've got paid to serve static content . ideally I'd like to set a quota ( monthly ) to some but the main idea is that I want to have mirrors of certain files worldwide .
    I do already spend a nice amount on this servers so I can't spend more on some dns providers that can end up sending me a bill I'd rather not want to as this would be to help some projects.


    How To Set Up a Mirror Director with MirrorBrain on Ubuntu 14.04 | DigitalOcean


    What do you guys suggest ?

    I'm already using CMM + CF

    Regards
     
  2. eva2000

    eva2000 Administrator Staff Member

    30,634
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    1:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    Never heard of MirrorBrain but anything that requires mysql/postgresql database usage will probably complicate things for mirroring/multiple server clusters usually. I'd rather use 3rd party GeoDNS and/or self-hosted load balancer (nginx or haproxy) and pure static files served directly. Means less system resource usage.

    If you use nginx as a load balancer you can use geoip nginx module to direct visitors to geographic backends etc Module ngx_http_geoip_module. I use geoip module and custom nginx mapping to serve ad banners based on visitor location on centminmod.com :)

    centmin mod already has geoip module and configuration requirements setup in /usr/local/nginx/conf/nginx.conf via include file
    Code (Text):
    include /usr/local/nginx/conf/geoip.conf;
    

    Code (Text):
    cat /usr/local/nginx/conf/geoip.conf
    # SET the path to the .dat file used for determining the visitor's country from the IP-address ###
    geoip_country /usr/share/GeoIP/GeoIP.dat;
    
    # SET the path to the .dat file used for determining the visitor's country from the IP-address ###
    geoip_city /usr/share/GeoIP/GeoIPCity.dat;

    Various ways to use nginx geoip module to give you ideas
     
    Last edited: Oct 29, 2017
    • Like Like x 1
  3. inthecloudblog

    inthecloudblog Active Member

    191
    36
    28
    Jan 26, 2016
    Ratings:
    +81
    Local Time:
    12:37 AM
    1.4.6
    Superb!
    Appreciate it
     
  4. eva2000

    eva2000 Administrator Staff Member

    30,634
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    1:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    • Like Like x 1
  5. inthecloudblog

    inthecloudblog Active Member

    191
    36
    28
    Jan 26, 2016
    Ratings:
    +81
    Local Time:
    12:37 AM
    1.4.6
    Simply great. Do not need 100% loc of consumers since I will be simply be helping them to make their downloads faster with the resources I have ( I'm not akamai :p )

    Appreaciate it @eva2000
     
  6. eva2000

    eva2000 Administrator Staff Member

    30,634
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    1:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    FYI, centmin mod 123.09beta01 already has PHP-FPM setup for PHP GeoIP too in /usr/local/nginx/conf/php.conf include file for each vhost
    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;
    
     
    • Like Like x 1
  7. inthecloudblog

    inthecloudblog Active Member

    191
    36
    28
    Jan 26, 2016
    Ratings:
    +81
    Local Time:
    12:37 AM
    1.4.6
    I don't follow what else to do since:

    Tried to see if this would help

    Before making any changes :

    and I added this to ( not commented)

    /usr/local/nginx/conf/nginx.conf

     

    Attached Files:

  8. eva2000

    eva2000 Administrator Staff Member

    30,634
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    1:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    and output of nginx -t ?
     
  9. inthecloudblog

    inthecloudblog Active Member

    191
    36
    28
    Jan 26, 2016
    Ratings:
    +81
    Local Time:
    12:37 AM
    1.4.6

    that's with my failed attempt commented out..
     
  10. eva2000

    eva2000 Administrator Staff Member

    30,634
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    1:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    with failed attempt in place use nginx -t to report the error nginx sees
     
  11. inthecloudblog

    inthecloudblog Active Member

    191
    36
    28
    Jan 26, 2016
    Ratings:
    +81
    Local Time:
    12:37 AM
    1.4.6
     
  12. eva2000

    eva2000 Administrator Staff Member

    30,634
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    1:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    yeah wrong file you put it in nginx.conf while it should be your site's nginx vhost config file
     
    • Agree Agree x 1
  13. inthecloudblog

    inthecloudblog Active Member

    191
    36
    28
    Jan 26, 2016
    Ratings:
    +81
    Local Time:
    12:37 AM
    1.4.6
    clueless.. same error while editing :
    nano /usr/local/nginx/conf/conf.d/abc.com.conf


     
  14. eva2000

    eva2000 Administrator Staff Member

    30,634
    6,862
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +10,308
    Local Time:
    1:37 PM
    Nginx 1.13.x
    MariaDB 5.5
    Code (Text):
    location /geo_country {
    return 200 "Visiting from :$geoip_country_name";
    }

    believe this isn't correct so try other methods like setting up an nginx mapped variable to $geoip_country_code

    contents of /usr/local/nginx/conf/conf.d/abc.com.conf ?

    the rest is up to you though
     
    Last edited: Nov 2, 2017
    • Like Like x 1