Welcome! Log In Create A New Profile

Advanced

Крякозябры в поле ($remote_addr) access.log при использовании сокетов?

Posted by Devis 
Конфигурация:

server {
listen *:80;
access_log /var/log/nginx/server1-access.log combined;
error_log /var/log/nginx/server1-error.log debug;

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

location / {
proxy_pass http://unix:/var/run/server2.sock;
break;
}
}

server {
listen unix:/var/run/server2.sock;
access_log /var/log/nginx/server2-access.log combined;
error_log /var/log/nginx/server2-error.log debug;

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

location / {
proxy_pass http://unix:/var/run/server3.sock;
break;
}
}

server {
listen unix:/var/run/server3.sock;
access_log /var/log/nginx/server3-access.log combined;
error_log /var/log/nginx/server3-error.log debug;

root /usr/share/nginx/www;
index index.html index.htm;

location / {
try_files $uri $uri/ /index.html;
}
}

Журналы после обращения к серверу по порту 80.

SERVER1-ACCESS.LOG

192.168.111.43 - - [05/Apr/2012:17:15:25 +0400] "GET / HTTP/1.1" 304 0 "-" "Opera/9.80 (X11; Linux x86_64; U; ru) Presto/2.9.168 Version/11.50"

SERVER1-ERROR.LOG

2012/04/05 17:15:25 [debug] 17111#0: *1 http proxy header:
"GET / HTTP/1.0
Host: 192.168.111.196
X-Real-IP: 192.168.111.43
X-Forwarded-For: 192.168.111.43
Connection: close
User-Agent: Opera/9.80 (X11; Linux x86_64; U; ru) Presto/2.9.168 Version/11.50
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: ru-RU,ru;q=0.9,en;q=0.8
Accept-Encoding: gzip, deflate
If-Modified-Since: Mon, 04 Oct 2004 15:04:06 GMT

SERVER2-ACCESS.LOG

unix:A\x02 - - [05/Apr/2012:17:15:25 +0400] "GET / HTTP/1.0" 304 0 "-" "Opera/9.80 (X11; Linux x86_64; U; ru) Presto/2.9.168 Version/11.50"

SERVER2-ERROR.LOG

2012/04/05 17:15:25 [debug] 17111#0: *3 accept: unix:A^B fd:19
...
2012/04/05 17:15:25 [debug] 17111#0: *3 http proxy header:
"GET / HTTP/1.0
Host: 192.168.111.196
X-Real-IP: unix:A^B
X-Forwarded-For: 192.168.111.43, unix:A^B
Connection: close
User-Agent: Opera/9.80 (X11; Linux x86_64; U; ru) Presto/2.9.168 Version/11.50
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/webp, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: ru-RU,ru;q=0.9,en;q=0.8
Accept-Encoding: gzip, deflate
If-Modified-Since: Mon, 04 Oct 2004 15:04:06 GMT


Используется формат по умолчанию - combined. Возникает вопрос - почему в access.log пишутся крякозябры в первом поле ($remote_addr)? Получается переменная $remote_addr содержит крякозябры, иначе как объяснить заполнение заголовков "X-Forwarded-For: 192.168.111.43, unix:A^B" и "X-Real-IP: unix:A^B "? Что я делаю не так?
Nginx 1.0.14, Сборка dotdeb.org.
Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 68
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready