frp+内网nginx环境 查看nginx的日志时,发现记录的ip全是内网ip,没有获取到真实的访问ip。
解决:
在frpc.ini 或者 frpc.toml 中修改如下:
[nginx]
type = https
local_ip = 172.20.1.200
local_port = 443
custom_domains = xxx true
proxy_protocol_version = v2
nginx端配置添加real_ip_header proxy_protocol;real_ip_recursive on;set_real_ip_from 127.0.0.1;字段,在 listen443后面加 http2 proxy_protocol
server{
real_ip_header proxy_protocol;
real_ip_recursive on;
set_real_ip_from 127.0.0.1;
listen 443 ssl http2 proxy_protocol;
}
然后重启frpc客户端和nginx再查看nignx logs日志显示用户访问真实ip