开启frpc内网穿透后nginx网站获取访问ip全是127.0.0.1本地ip的解决办法

大谋儿 3年前 知识探索 阅读 7600

首选修改frpc.ini配置

添加一行

proxy_protocol_version = v2

每个需要的隧道都要添加

[xxxxxxxxxxxxx]
# 备注:-xxxxxxx
privilege_mode = true
type = http
local_ip = 127.0.0.1
local_port = 80
custom_domains = bangshun.com
use_encryption = true
use_compression = true
proxy_protocol_version = v2

修改网站的配置文件,替换或者添加如下内容

server{
listen 80 proxy_protocol;
listen 443 ssl proxy_protocol;
set_real_ip_from 111.111.111.111;#frp服务端ip
set_real_ip_from 127.0.0.1;
real_ip_header proxy_protocol;
real_ip_recursive on;
省
略
后
面
一
大
堆
}

重启一下frpc和nginx试试吧

frpc真实ip.jpg

最后更新:2023-03-21 19:46:19
分享到:

评论 (0)

发表评论

验证码