温馨提示×

centos jellyfin如何开启https

小樊
62
2026-09-30 02:19:10
栏目: 智能运维

在 CentOS 上给 Jellyfin 开启 HTTPS,常见有两种方式:


方式一:使用反向代理(推荐,最常用)

通过 Nginx / Caddy 提供 HTTPS,Jellyfin 本身仍走 HTTP。

1️⃣ 安装 Nginx

sudo yum install nginx -y
sudo systemctl enable --now nginx

2️⃣ 申请 SSL 证书(以 Let’s Encrypt 为例)

sudo yum install certbot python3-certbot-nginx -y
sudo certbot --nginx -d jellyfin.yourdomain.com

3️⃣ 配置 Nginx 反向代理

编辑配置:

sudo vi /etc/nginx/conf.d/jellyfin.conf

示例配置:

server {
    listen 80;
    server_name jellyfin.yourdomain.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl;
    server_name jellyfin.yourdomain.com;

    ssl_certificate /etc/letsencrypt/live/jellyfin.yourdomain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/jellyfin.yourdomain.com/privkey.pem;

    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;
    }
}

4️⃣ 重载 Nginx

sudo nginx -t
sudo systemctl reload nginx

✅ 访问:https://jellyfin.yourdomain.com


方式二:Jellyfin 自带 HTTPS(不推荐公网)

适合内网或测试环境。

1️⃣ 准备证书

需要:

  • cert.pfx(包含私钥)

生成示例(自签):

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365
openssl pkcs12 -export -out cert.pfx -inkey key.pem -in cert.pem

2️⃣ 修改 Jellyfin 配置

编辑:

/etc/jellyfin/network.xml

示例:

<IsHttps>true</IsHttps>
<HttpsPort>8920</HttpsPort>
<CertificatePath>/path/to/cert.pfx</CertificatePath>
<CertificatePassword>你的密码</CertificatePassword>

3️⃣ 重启 Jellyfin

sudo systemctl restart jellyfin

✅ 访问:https://IP:8920


✅ 推荐方案总结

场景 推荐方式
公网访问 Nginx + Let’s Encrypt
内网/测试 Jellyfin 自带 HTTPS
简单省事 Caddy 自动 HTTPS

如果你告诉我:

  • CentOS 版本(7 / 8 / Stream)
  • 是否有域名
  • 是否公网 IP

我可以给你 精确配置命令。

0 踩