Autor Subiect: Restrictie GeoIP in centos7  (Citit de 816 ori)

Admin

  • Administrator
  • guru
  • *****
  • Mesaje postate: 56
  • Karma: +0/-0
Restrictie GeoIP in centos7
« : Iulie 19, 2020, 07:17:00 p.m. »
Se instaleaza

yum install mod_geoip GeoIP GeoIP-devel GeoIP-data zlib-devel

In /usr/share/GeoIP/ trebuie puse GeoIP.dat pe care il download de aici:

https://mirrors-cdn.liferay.com/geolite.maxmind.com/download/geoip/database/

In etc/httpd/conf.d/ aveti geoip.conf care ar trebui sa arate asa:
<IfModule mod_geoip.c>
  GeoIPEnable On
  GeoIPDBFile /usr/share/GeoIP/GeoIP.dat MemoryCache
</IfModule>

restart apache apoi puteti testa astfel:

<?php

    $tara = getenv(GEOIP_COUNTRY_NAME);
    $zona = getenv(GEOIP_CONTINENT_CODE);
    echo $tara." ".$zona;

Intrebari?