geo_ip для apache 2.4 на centos + cpanel easyapache 4 (ea4)

  1. Step one login to your server. I personally just ‘su root’ instead of ‘sudo’ all the time, but I’m lady, and confident I won’t ‘rm -rf /lib’ or something equally as asinine.

  1. Now you’re going to want to issue this command;
  2. Then, we’re going to want to issue the following to create the GeoIP directory, and enter it
  3. Now we’ll want to grab the data files from MaxMind. These commands with download the city and country info.
  4. Now we’re going to want to install some requirements for everything to build. If you already have something installed from this list it will just ignore it and install the rest.

    в моем случае достаточно было установить:
  5. Now you’re going to want to grab the GeoIP source for apache module. Then, uncompress it, and, enter the directory.
  6. Now we have to make a change due to apache 2.4 and some name changes, so, run this command now.
  7. And finally we can go ahead and compile the module.
  8. Now we just have to modify the httpd.conf file for Apache to load the module
  9. Change the content of this file so instead of looking like this;

    instead, make sure it looks like this;

    Then, exit and save the file.
  10. Now you’ll want to restart apache.
  11. Then you can go ahead and create an info file and check via the web if geoip is supported.
  12. Put these contents in it
  13. Close and exit the file, then visit your site at http://YOUR_DOMAIN.COM/info.php and you should see something similar to the following.geoip-easyapache4

  14. Congrats, you’re done!


Для конфигурации конкретного виртуального хоста, можно воспольщзоваться .htaccess в таком случае содержимое файла должно быть следующим:

#GeoIPEnable On
Deny from env=BlockCountry
Allow from <YOUR excluded IP>

Для глобавльной конфигурации apache

Добавить комментарий

Ваш адрес email не будет опубликован.