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. Get your own self-hosted blog with a Free Domain at ($3.45/month).
  4. Become a Supporter - Make a contribution via PayPal
  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...

23 Responses

  1. Jasmin says:

    i get error: /usr/bin/perl: symbol lookup error: /usr/local/lib64/perl5/auto/Geo/IP/ undefined symbol: GeoIP_open

  2. cjwalter says:

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

  3. Naval saini says:

    Nice article
    Each and every step clearly defined

  4. Krunal says:

    What about nginx ?

  5. 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?


  6. 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 *

This site uses Akismet to reduce spam. Learn how your comment data is processed.