在 CentOS 上给 Jellyfin 配置域名,通常分三步:域名解析 → 反向代理(Nginx) → HTTPS(可选但推荐)。下面以 CentOS 7/8 + Nginx 为例说明。
8096)media.example.com)在域名服务商处添加 A 记录:
media.example.com → 你的服务器公网IP
生效可用:
ping media.example.com
# CentOS 7
yum install -y nginx
# CentOS 8
dnf install -y nginx
systemctl enable --now nginx
新建配置文件:
vi /etc/nginx/conf.d/jellyfin.conf
内容示例(HTTP 版):
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;
}
}
测试并重载:
nginx -t
systemctl reload nginx
此时可通过:
http://media.example.com
访问 Jellyfin。
# CentOS 7
yum install -y epel-release
yum install -y certbot python2-certbot-nginx
# CentOS 8
dnf install -y certbot python3-certbot-nginx
certbot --nginx -d media.example.com
按提示选择是否强制 HTTPS。
登录 Jellyfin → 控制台 → 网络
建议设置:
/ (一般不用改)media.example.comfirewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=https
firewall-cmd --reload
8096 是否监听ss -lntp | grep 8096
在 Nginx 中补充:
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
如果你愿意,我可以:
你目前是 CentOS 几?Jellyfin 装在 Docker 还是原生?