Install Mod_GeoIP for Apache in RHEL/CentOS 6.3/5.8

If You Appreciate What We Do Here On TecMint, You Should Consider:

  1. Stay Connected to: Twitter | Facebook | Google Plus
  2. Subscribe to our email updates: Sign Up Now
  3. Use our Linode referral link if you plan to buy VPS (it starts at only $10/month).
  4. Support us via PayPal donate - Make a Donation
  5. Support us by purchasing our premium books in PDF format.
  6. Support us by taking our online Linux courses

We are thankful for your never ending support.

Ravi Saive

I am Ravi Saive, creator of TecMint. A Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux. Follow Me: Twitter, Facebook and Google+

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide

You may also like...

21 Responses

  1. cjwalter says:

    I used the sample script, it shows the IP, not showing Country name .

  2. Naval saini says:

    Nice article
    Each and every step clearly defined

  3. Krunal says:

    What about nginx ?

  4. Stan says:


    deny on geopip.conf does not work. I get the error:

    Stopping httpd: [ OK ]
    Starting httpd: Syntax error on line 21 of /etc/httpd/conf.d/geoip.conf:
    deny not allowed here

    i used the syntax:

    SetEnvIf GEOIP_COUNTRY_CODE DE AllowCountry
    SetEnvIf GEOIP_COUNTRY_CODE AT AllowCountry

    Deny from all
    Allow from env=AllowCountry

    How can i fix this?


  5. Peter says:

    Hi there, nice article.
    But how can I block countries for all my domains which are hosted on my server.
    Or should I have to paste the code into each .htaccess for each domain?

    • Ravi Saive says:

      Yes, you must create a specific .htaccess file under each domain and add the following example of code to block countries.

      SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
      SetEnvIf GEOIP_COUNTRY_CODE RU BlockCountry
      Deny from env=BlockCountry

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

Join Over 300K+ Linux Users
  1. 177,942
  2. 8,310
  3. 37,548

Are you subscribed?