nginx/0.8.49
php in fastcgi mode, php version 5.3.5
pieces of nginx cofig file:
default log format:
log_format main '$remote_addr - - [$time_local] “$request” ’
'$status $body_bytes_sent “$http_referer” ’
‘“$http_user_agent”’;
access_log /app/logs/default.log main;
location ~ .*\.php$ {
fastcgi_pass 127.0.0.1:9000;
#fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME
/usr/local/www/default$fastcgi_script_name;
include /usr/local/nginx/conf/fastcgi_params;
}
contents of fastcgi_params:
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
PHP only, required if PHP was built with --enable-force-cgi-redirect
fastcgi_param REDIRECT_STATUS 200;
problem is:
I got this in my log:
124.95.xx.yy - - [01/Aug/2012:15:22:48 +0800] “GET
/ch111/index.php?111234 HTTP/1.0” 200 1483 “-” “Mozilla/4.0 (compatible;
MSIE 8.0; Windows NT 5.1; Trident/4.0)”
And I got $_SERVER[‘REMOTE_ADDR’] with a different ip when it is shown
on client’s browser.
I am sure that the different ips are from the same client.
Before my web server, I have no balancers or other devices, but I am not
of the client’s side.
Even if the client goes through some kind of proxy, no matter squid or
commercial ones, $_SERVER[‘REMOTE_ADDR’] should be always the same with
what is shown in nginx’s log.
Posted at Nginx Forum: