Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
X-Forwarded-For и X-Real-IP совпадают
Здравствуйте!
У меня возникла такая проблема - в phpinfo выводится следующее:
X-Forwarded-For 83.167.102.xxx
X-Real-IP 83.167.102.xxx
То есть и там, и там - два одинаковых IP адреса. Это не дает нормально
посчитать посещения сайта. Причем указывается адрес пользователя.
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
#----------------------------------------------------------------------
# Events Module
#
# http://wiki.codemongers.com/NginxEventsModule
#
#----------------------------------------------------------------------
events {
worker_connections 1024;
}
#----------------------------------------------------------------------
# HTTP Core Module
#
# http://wiki.codemongers.com/NginxHttpCoreModule
#
#----------------------------------------------------------------------
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] $request '
'"$status" $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;
#
# The default server
#
client_max_body_size 16m;
server {
listen 188.72.226.197:80;
server_name XXXXX.ru www.XXXXX.ru hosting.XXXXX.ru
www.hosting.XXXXX.ru;
rewrite ^(/manager/.*)$ https://$host$1 permanent;
location ~* ^/(webstat/|awstats|webmail/|myadmin/|manimg/) {
proxy_pass http://188.72.226.197:8080;
proxy_redirect http://XXXXX.ru:8080/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
proxy_pass http://188.72.226.197:8080;
proxy_redirect http://XXXXX.ru:8080/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
location ~*
^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar)$ {
root /var/www/XXXXX/data/www/XXXXX.ru;
access_log /var/www/httpd-logs/XXXXX.ru.access.log;
error_page 404 = @fallback;
Это мой конфиг nginx.
Использую версию 0.6.39
Posted at Nginx Forum: http://forum.nginx.org/read.php?21,39455,39455#msg-39455
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru
|