尝试了在nginx.conf的http中添加如下代码
- log_format access '-$proxy_protocol_addr-,--$remote_addr--,---$http_x_forwarded_for---,----$proxy_add_x_forwarded_for----,$remote_user,$time_local,$host,$request,$status,$http_referer,$HTTP_X_UP_CALLING_LINE_ID,$request_time,$http_user_agent $upstream_addr $upstream_response_time $upstream_cache_status';
复制代码
网站配置文件中添加如下代码
- proxy_set_header X-Real-IP $proxy_protocol_addr;
- proxy_set_header X-Forwarded-For $proxy_protocol_addr;
复制代码
但网站日志中仍然不能显示真实访客IP
|