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
0 comments:
Post a Comment