Country Blocking with nginx GeoIP on Ubuntu/Debian

On Ubuntu/Debian, install nginx geoip module with apt install geoip-database libgeoip1 libnginx-mod-http-geoip -y Now edit nginx.conf vi /etc/nginx/nginx.conf Find http { Add below geoip_country /usr/share/GeoIP/GeoIP.dat; map $geoip_country_code $my_country_blocker { default no; US yes; AU yes; CA yes; } You can add 2 letter country code and set ye/no as required. To implement GeoIP blocking for … Read more

Install GeoIP PHP Module in Ubuntu

To install GeoIP php module in Ubuntu, run apt install php-geoip To enable module, run phpenmod geoip You can see the PHP module with command php -m root@ip-172-31-26-233:~# php -m | grep geoip geoip root@ip-172-31-26-233:~# Also it will be listed in phpinfo page. geoip

geoip

PHP Script to Find GeoIP info Install GeoIP Apache Module in CentOS Install GeoIP PHP Module in Ubuntu Country Blocking with nginx GeoIP on Ubuntu/Debian