I used GeoIP library with Nginx for quite some time, but it came to EOL. GeoIP2 is now avalible. It is great tool for blocking unwanted traffic from your webserver. This was done on Centos 7. If you don’t want to pay for getpagespeed’s payed version, than you must build this module from source.
First, you’ll need to know your curent NGINX version
[root@myserver ~]# nginx -v
nginx version: nginx/1.16.1
Then, download exact same version of NGINX from this site and unpack it. In my case:
[root@myserver ~]# wget http://nginx.org/download/nginx-1.16.1.tar.gz
[root@myserver ~]# tar -xvzf nginx-1.16.1.tar.gz
[root@myserver ~]# cd nginx-1.16.1.tar.gz
Then you should download ngx_http_geoip2_module – geoip2 module for NGINX:
[root@myserver ~]# wget https://github.com/leev/ngx_http_geoip2_module/archive/master.zip
[root@myserver ~]# unzip master.zip
You should install GCC and Development Tools for dependencies.
[root@myserver ~]# yum groupinstall ‘Development Tools’
[root@myserver ~]# yum install gcc
Recent Comments