在 CentOS 上让 Jellyfin 支持外网访问,核心思路是:
Jellyfin 本身只负责服务,外网访问靠端口映射 / 反向代理 / 内网穿透。下面按最常见、最稳妥的方式一步步来。
systemctl status jellyfin
默认端口是:
http://服务器IP:8096
CentOS 7/8/Stream 默认用 firewalld
sudo firewall-cmd --permanent --add-port=8096/tcp
sudo firewall-cmd --reload
确认:
firewall-cmd --list-ports
适合:家里 / 公司服务器有公网 IP
curl ifconfig.me
在路由器 WAN 口看到的 IP 是否一致
❌ 不一致 → 你是 NAT 内网(运营商 CGNAT),看方案三
登录路由器 → 端口转发 / 虚拟服务器:
| 项目 | 值 |
|---|---|
| 外部端口 | 8096(或自定义) |
| 内部 IP | Jellyfin 服务器内网 IP |
| 内部端口 | 8096 |
| 协议 | TCP |
http://你的公网IP:8096
✅ 成功即可
适合:80/443 端口可用,想用域名
yum install -y nginx
systemctl enable --now nginx
vim /etc/nginx/conf.d/jellyfin.conf
server {
listen 80;
server_name jellyfin.example.com;
location / {
proxy_pass http://127.0.0.1:8096;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
nginx -t
systemctl reload nginx
外网访问:
http://jellyfin.example.com
适合:运营商 NAT / 云服务器无法用
| 工具 | 特点 |
|---|---|
| frp | 免费、稳定、专业 |
| ZeroTier | 组虚拟局域网 |
| Tailscale | 最简单 |
[jellyfin]
type = tcp
local_ip = 127.0.0.1
local_port = 8096
remote_port = 8096
外网访问:
http://云服务器IP:8096
否则会被劫持、账号泄露
✅ 用:
进入:
控制台 → 网络
0.0.0.0你可以直接告诉我:
1️⃣ CentOS 版本
2️⃣ 有没有公网 IP
3️⃣ 用不用域名
4️⃣ 是家庭宽带还是云服务器
我可以 直接给你一条龙配置命令 ✅