Blocking IP From All The Country With GeoIP ( VestaCP )

Posted On // 1 comment

First, I want block my country Indonesia to access my site, my site is wordpress based, and i use a plugin iq-block-country, i don't know why that plugin isn't working and ruin my site.


I use VestaCp for my webserver just install a module geoip with this command


$ sudo apt-get install libapache2-mod-geoip


And then edit apache2.conf in /home/admin/conf/web/apache2.conf


$ sudo nano /home/admin/conf/web/apache2.conf


Add the code below into our config :


GeoIPEnable On GeoIPDBFile /usr/share/GeoIP/GeoIP.dat SetEnvIf GEOIP_COUNTRY_CODE ID BlockCountry


Before the line IncludeOptional /home/admin/conf/web/apache2.yourwebsite.com.conf*


ID is code the coutry of Indonesia, you can change or add ID in SetEnvIf GEOIP_COUNTRY_CODE ID BlockCountry with another.


Save it and then edit .htacces in your public_html directory , fill with the following code :


Deny from env=BlockCountry


And then save and restart the apache service.


$ sudo service httpd restart


Done. Is for ubuntu only, in the next post i will post if the operating system is centos .


Thank you, i think this is just beginner tutorial. i am sorry if This tutorial is not very useful for you.


Best Regards.


http://ift.tt/1dvHQ0Z

1 comment:

  1. As you are providing information about Blocking IP From All The Country With GeoIP ( VestaCP ). Basically, we want to say that your knowledge really impressive that should be spread to all over the world so that you should create a website where you can provide the all information about it. So to do the website you need a perfect hosting solution. Contact to Onlive Server for better information. you can choose USA VPS Hosting

    ReplyDelete