Welcome! Log In Create A New Profile

Advanced

Get Country Code according to first IP (Maxming)

Posted by anshuman91 
Get Country Code according to first IP (Maxming)
March 20, 2017 04:37PM
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?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 305
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready