Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Get Country Code according to first IP (Maxming)

$
0
0
I am using maxmind module in nginx to get country code of visiters IP. Below are my some configuration part of nginx.config file,

geoip_country /etc/nginx/geo_ip/GeoIP.dat;

location ~ \.php$ {
root /home/app;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
}

In php $_SERVER['HTTP_X_FORWARDED_FOR'], I am getting 2 (two) IPs and these are comma separated. So nginx maxmind module giving me country code according to second IP. So I want to get country Code according to first IP. Can anyone please help me in this issue?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>