首页>>帮助中心>>如何在Centos美国服务器上为Jellyfin设置SSL证书

如何在Centos美国服务器上为Jellyfin设置SSL证书

2025/4/14 26次
在CentOS美国服务器上为Jellyfin设置SSL证书,可以按照以下步骤进行:

方法一:使用Let’s Encrypt和Certbot
安装Certbot
sudo yum install epel-release
sudo yum install certbot python3-certbot-nginx

获取SSL证书 使用Certbot获取Let’s Encrypt的SSL证书。假设你的域名是yourdomain.com,运行以下命令:
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

Certbot会自动配置Nginx并生成证书。
配置Jellyfin使用HTTPS 编辑Jellyfin的配置文件/etc/jellyfin/config/config.xml,找到或添加以下部分:
<Server>
<HttpPort>8096</HttpPort>
<HttpsPort>8443</HttpsPort>
<CertificatePath>/etc/letsencrypt/live/yourdomain.com/fullchain.pem</CertificatePath>
<PrivateKeyPath>/etc/letsencrypt/live/yourdomain.com/privkey.pem</PrivateKeyPath>
</Server>

确保CertificatePath和PrivateKeyPath指向正确的证书和私钥文件路径。
重启Jellyfin服务
sudo systemctl restart jellyfin

方法二:手动安装SSL证书
获取SSL证书 你可以从Let’s Encrypt或其他证书颁发机构(CA)获取SSL证书。假设你已经有了证书文件fullchain.pem和私钥文件privkey.pem。
配置Nginx 编辑Nginx配置文件/etc/nginx/nginx.conf或创建一个新的配置文件(例如/etc/nginx/conf.d/jellyfin.conf),添加以下内容:
server {
listen 80;
server_name yourdomain.com www.yourdomain.com;
return 301 https://$host$request_uri;
}

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

ssl_certificate /path/to/fullchain.pem;
ssl_certificate_key /path/to/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;

location / {
proxy_pass http://localhost: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;
}
}

确保ssl_certificate和ssl_certificate_key指向正确的证书和私钥文件路径。
重启Nginx服务
sudo systemctl restart nginx

配置Jellyfin使用HTTPS 编辑Jellyfin的配置文件/etc/jellyfin/config/config.xml,找到或添加以下部分:
<Server>
<HttpPort>8096</HttpPort>
<HttpsPort>8443</HttpsPort>
<CertificatePath>/path/to/fullchain.pem</CertificatePath>
<PrivateKeyPath>/path/to/privkey.pem</PrivateKeyPath>
</Server>

确保CertificatePath和PrivateKeyPath指向正确的证书和私钥文件路径。
重启Jellyfin服务
sudo systemctl restart jellyfin

通过以上步骤,你应该能够在CentOS上成功为Jellyfin设置SSL证书。

购买使用一诺网络美国服务器,可以极大降低初创企业、中小企业以及个人开发者等用户群体的整体IT使用成本,无需亲自搭建基础设施、简化了运维和管理的日常工作量,使用户能够更专注于自身的业务发展和创新。美国服务器低至49/月,购买链接:https://www.enuoidc.com/vpszq.html?typeid=3

版权声明

    声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们996811936@qq.com进行处理。