日志格式:
log_format main '[$http_h1ost][$http_x_real_ip] [$http_x_forwarded_for] [$remote_addr] [$remote_port] [$server_addr]';
服务段:
server {
listen 80;
server_name
xx.xxx.com;
#charset koi8-r;
access_log logs/access.log main ;
error_log logs/error.log debug;
location / {
proxy_pass
http://xxx.com:8080;
index index.html index.htm index.jsp default.jsp index.action index.do default.action default.do;
proxy_set_header h1ost $host;
proxy_set_header X-real-ip $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
然后我查看日志记录,是这样的
[-][-] [-] [133.126.116.250] [52849] [131.201.192.51]
[-][-] [-] [133.126.116.250] [19025] [131.201.192.51]
也就是说我自定义的变量没有获取到,然后我搜了一下,说是要配置http部分,增加underscores_in_headers on;
但也没用,求帮助啊!