Nginx

How to make nginx works with Geo IP?

NGINX GeoIP Installation:

Follow these steps to install GeoIP with nginx:

wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz

tar -zxvf GeoIP.tar.gz
cd GeoIP-1.4.8/
./configure
make
make install
echo ‘/usr/local/lib’ > /etc/ld.so.conf.d/geoip.conf
yum install gcc pcre-devel.x86_64 openssl-devel.x86_64
yum install readline-devel pcre-devel openssl-develWe are using openresty – nginx here:wget http://openresty.org/download/ngx_openresty-1.7.2.1.tar.gz
tar xzvf ngx_openresty-1.7.2.1.tar.gz
cd ngx_openresty-1.7.2.1
./configure –with-luajit –with-http_geoip_module
gmake
gmake installwget http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz -O /usr/local/share/GeoIP/GeoIP.dat.gz
gunzip /usr/local/share/GeoIP/GeoIP.dat.gz
In nginx.conf  http block – geoip_country /usr/local/share/GeoIP/GeoIP.dat;Reload nginx – nginx -s reload

You Might Also Like