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