记录一下使用FRP内网穿透Jellyfin时不显示真实IP的解决办法
2025-01-30 13:53:53

一. frpc服务器上安装Ngnix

  1. 我的是Debian其他自行搜索
1
2
3
4
apt install nginx -y
#启动并设置nginx开机启动
systemctl start nginx
systemctl enable nginx

二. 配置Nginx支持proxy_protocol

  1. 编辑nginx配置文件
1
nano /etc/nginx/nginx.conf
  1. 在http块中添加下面内容
1
2
3
4
5
6
http {
...#位置随意
real_ip_header proxy_protocol;
set_real_ip_from 0.0.0.0/0; # 允许所有IP
...
}
  1. 给jellyfin创建一个nginx代理
1
nano /etc/nginx/conf.d/jellyfin.conf
  1. 添加下面内容
1
2
3
4
5
6
7
8
9
10
11
server {
listen 8096 proxy_protocol; # 监听8096端口并启用proxy_protocol
server_name _;

location / {
proxy_pass http://192.168.88.11:8096; # 转发到Jellyfin服务器
proxy_set_header Host $host;
proxy_set_header X-Real-IP $proxy_protocol_addr; # 获取真实IP
proxy_set_header X-Forwarded-For $proxy_protocol_addr;
}
}
  1. 保存并测试
1
2
3
4
nginx -t
#输出
...................................ok
...................................successful
  1. 测试成功,重新加载nginx
1
systemctl reload nginx

三 .配置frpc.toml

  1. nano frpc.toml
1
2
3
4
5
6
7
8
[Jellyfin]
type=tcp
remote_port=29080
local_ip=192.168.88.110
local_port=8096
proxy_protocol_version=v2
use_encryption=true
use_compression=true

四 .重启frpc&&frps&&Jellyfin

!!!!注意拼写错误,纯手打