Logo
  • Home
  • About
  • Services
  • Blogs
  • Career
  • Contact
Logo

The UK's #1 Software Development Company. PodTech IO builds custom software solutions for businesses. Call today for a free consultation

  • Address

    4th Floor, 4 Tabernacle Street London EC2A 4LU
  • Email

    info@podtech.com
  • Contact

    +44 (0) 20 8720 6583

Block IPs by country – Apache

  • Home
  • Block IPs by country – Apache
  • By podtech
  • In Apache UNIX

Step 1

If you are using debian or ubuntu, install the mod-geoip package.

sudo apt-get install libapache2-mod-geoip

 

Step 2
Enable GeoIPEnable, edit geoip.conf

/etc/apache2/mods-enabled/geoip.conf
GeoIPEnable On

 

Step 3
Find Country Code Lookup: https://en.wikipedia.org/wiki/ISO_3166-1

In Apache vhosts file, outside of the </Directory> tags:

<Location />
        ##ISO 3166 Country Codes
        ## Block China
        ## Block Costa Rica
        ## Block Russia
        SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
        SetEnvIf GEOIP_COUNTRY_CODE RU BlockCountry
        SetEnvIf GEOIP_COUNTRY_CODE CR BlockCountry
        Deny from env=BlockCountry
</Location>

Step 4
service apache2 restart

 

ApacheBlock IPsBlock IPs by country
Count tables MYSQL
Git Count Commits by Date

Recent Posts

  • What is Software Piracy?
  • Microsoft and SITA Launch New Innovation Center in South Africa
  • Ericsson, Qualcomm and Thales to Launch 5G into Space
  • Schneider Electric Launches Free Data Center Professional Education Platform
  • UK and South Korea Reach Data Sharing Agreement

PodTech IO

The UK's #1 Software Development Company. PodTech IO builds custom software solutions for businesses. Call today for a free consultation

Company

  • About
  • Services
  • Contact
  • Blogs
  • Career

Terms

  • Terms & Conditions
  • Privacy Policy

Contact Us

  • ADDRESS

    Headquarter: Tabernacle Street London India: Vi john Tower, Gurgaon, Haryana
  • EMAIL

    info@podtech.com
  • CONTACT

    +44 (0) 20 8720 6583

Copyright ©2022 PodTech IO. All Rights Reserved

Logo