为了能快速了解并处理您的问题,请提供以下基础信息:面板、插件版本:8.0.0
系统版本:Ubuntu 18.04.6 LTS x86_64(Py3.7.8)
问题描述:“Nginx获取不到真实IP
相关截图(日志、错误):
|
|
RT
在nginx前面套了一层雷池WAF,经测试,WAF会在header中添加X-Forwarded-For字段,会带上客户端真实IP
但是nginx获取到的还是waf的地址,也就是127.0.0.1
经查阅资料,说是nginx默认的log_format需要调整下,
将
- log_format combined '$remote_addr-$remote_user [$time_local]'
- ‘"$request"$status $body_bytes_sent’
- ‘"$http_referer" "$http_user_agent"’
复制代码 调整为
- log_format mylogformat '$http_x_forwarded_for_$remote_user [$time_local]'
- ‘"$request"$status $body_bytes_sent’
- ‘"$http_referer" "$http_user_agent"’
复制代码
可是我没有发现在哪里调整,默认的nginx配置文件 /www/server/nginx/conf/nginx.conf 里并没有自带的logfomat
请问下这个需要怎么设置?
|
|