在 CentOS 上让 Jellyfin 支持外网访问,一般有以下几种常见方式。下面按推荐程度从易到难说明,你可以根据自己环境选择。
https://jellyfin.example.com 访问systemctl status jellyfin
默认端口是 8096
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=443/tcp
firewall-cmd --reload
yum install nginx -y
systemctl enable --now nginx
vi /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;
}
}
yum install certbot python3-certbot-nginx -y
certbot --nginx -d jellyfin.example.com
✅ 完成后即可外网访问:
https://jellyfin.example.com
8096外部端口 8096 → 内部IP:8096
firewall-cmd --permanent --add-port=8096/tcp
firewall-cmd --reload
http://你的公网IP:8096
⚠️ 缺点:
# 安装 cloudflared
cloudflared tunnel --url http://localhost:8096
✅ 不用公网 IP
✅ 自带 HTTPS
在 Jellyfin 后台: 设置 → 网络
Known proxies✅ 不要长期暴露 8096
✅ 使用 HTTPS
✅ 设置强密码
✅ 可限制 IP 或加 Basic Auth
如果你愿意,可以告诉我:
我可以给你一步步精确命令。