Incorrect IP Address Deducted by Nginx version: nginx/1.2.1
sivakr
nginx-forum at nginx.us
Wed Feb 19 17:18:37 UTC 2014
REAL IP value not passing
location ~ \.php$ {
root /var/www;
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
include fastcgi_params;
}
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param HTTP_X_REAL_IP $http_x_real_ip;
fastcgi_param REMOTE_PORT $remote_port;
<?php
print_r($_SERVER);
?>
response
Array ( [USER] => www-data [HOME] => /var/www [FCGI_ROLE] => RESPONDER
[SCRIPT_FILENAME] => /var/www/test.php [QUERY_STRING] => [REQUEST_METHOD] =>
GET [CONTENT_TYPE] => [CONTENT_LENGTH] => [SCRIPT_NAME] => /test.php
[REQUEST_URI] => /test.php [DOCUMENT_URI] => /test.php [DOCUMENT_ROOT] =>
/var/www [SERVER_PROTOCOL] => HTTP/1.1 [GATEWAY_INTERFACE] => CGI/1.1
[SERVER_SOFTWARE] => nginx/1.2.1 [REMOTE_ADDR] => 122.1xx.xx.227
[HTTP_X_REAL_IP] => [REMOTE_PORT] => 17467 [SERVER_ADDR] => xxxx
[SERVER_PORT] => 80 [SERVER_NAME] =>xxxx [HTTPS] => [REDIRECT_STATUS] => 200
[GEOIP_COUNTRY_CODE] => IN [GEOIP_COUNTRY_NAME] => India [HTTP_HOST] => xxxx
[HTTP_CONNECTION] => keep-alive [HTTP_CACHE_CONTROL] => max-age=0
[HTTP_ACCEPT] =>
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
[HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36
(KHTML, like Gecko) Chrome/32.0.1700.107 Safari/537.36
[HTTP_ACCEPT_ENCODING] => gzip,deflate,sdch [HTTP_ACCEPT_LANGUAGE] =>
en-GB,en-US;q=0.8,en;q=0.6 [PHP_SELF] => /test.php [REQUEST_TIME_FLOAT] =>
1392830171.8188 [REQUEST_TIME] => 1392830171 )
Thanks
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,247736,247745#msg-247745
More information about the nginx
mailing list