要在CentOS上配置Jellyfin的网络访问权限,请按照以下步骤操作:
首先,确保你已经在CentOS上安装了Jellyfin。你可以从Jellyfin官方网站下载并安装最新版本的Jellyfin。
CentOS默认使用firewalld
作为防火墙。你需要允许HTTP(端口80)和HTTPS(端口443)流量通过防火墙。
sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --permanent --zone=public --add-service=https
sudo firewall-cmd --reload
如果SELinux处于 enforcing 模式,你可能需要配置SELinux以允许Jellyfin的网络访问。
sudo setsebool -P httpd_can_network_connect 1
编辑Jellyfin的配置文件/etc/jellyfin/config/config.json
,确保以下设置:
{
"network": {
"listen_ports": [8096],
"public_ip": "your_public_ip_address"
}
}
将your_public_ip_address
替换为你的服务器的公共IP地址。
如果你希望通过域名访问Jellyfin,并且希望使用HTTPS,可以配置一个反向代理服务器(如Nginx或Apache)。
sudo yum install epel-release
sudo yum install nginx
sudo systemctl start nginx
sudo systemctl enable nginx
编辑Nginx配置文件/etc/nginx/conf.d/jellyfin.conf
,添加以下内容:
server {
listen 80;
server_name your_domain.com;
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;
}
}
将your_domain.com
替换为你的域名。
sudo nginx -s reload
现在,你应该可以通过浏览器访问Jellyfin了。打开浏览器并输入你的服务器的公共IP地址或域名,你应该能够看到Jellyfin的登录页面。
如果你希望通过HTTPS访问Jellyfin,可以使用Let’s Encrypt免费获取SSL证书。
sudo yum install certbot python3-certbot-nginx
sudo certbot --nginx -d your_domain.com
按照提示完成证书的获取和安装过程。
完成以上步骤后,你应该能够通过HTTPS安全地访问Jellyfin了。