eForum.ro

Programare & stuff => Cum instalez .. => Subiect creat de: Admin din Iulie 19, 2020, 07:17:00 p.m.

Titlu: Restrictie GeoIP in centos7
Scris de: Admin din 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?