在 CentOS 上给 Jellyfin 绑定域名,通常分三步:解析域名 → 用 Web 服务器反代 → 配置 HTTPS(可选但推荐)。下面给你一套最常用、稳定的方案(Nginx + 域名 + HTTPS)。
media.example.com)8096)sudo yum install epel-release -y
sudo yum install nginx -y
sudo systemctl enable nginx
sudo systemctl start nginx
sudo vi /etc/nginx/conf.d/jellyfin.conf
server {
listen 80;
server_name media.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;
# WebSocket 支持(Jellyfin 必须)
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
sudo nginx -t
sudo systemctl restart nginx
✅ 此时访问 http://media.example.com 就能打开 Jellyfin
sudo yum install certbot python3-certbot-nginx -y
sudo certbot --nginx -d media.example.com
按提示操作,证书会自动配置好。
✅ 访问 https://media.example.com
控制台 → 网络
勾选或填写:
https://media.example.comhttps://media.example.com如果你只允许域名访问:
80 / 4438096 公网端口sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
→ 检查 Nginx 是否支持 WebSocket(上面配置已包含)
→ Jellyfin 网络设置里域名必须和访问地址完全一致
→ 检查云厂商安全组 + CentOS 防火墙
如果你告诉我:
我可以直接给你精准配置。