Programare & stuff > Cum instalez ..

Restrictie GeoIP in centos7

(1/1)

Admin:
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?

Navigare

[0] Indexul de Mesaje

Du-te la versiunea completă