在CentOS上实现Jellyfin的远程访问,通常需要以下几个步骤:
安装Jellyfin: 如果你还没有安装Jellyfin,可以通过以下命令安装:
sudo dnf install jellyfin
配置防火墙:
确保你的CentOS服务器上的防火墙允许HTTP(80)和HTTPS(443)流量。你可以使用firewall-cmd
命令来配置防火墙:
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
配置SELinux(如果启用): 如果SELinux处于 enforcing 模式,你可能需要配置它以允许Jellyfin的网络访问。你可以临时将SELinux设置为 permissive 模式来测试是否是SELinux阻止了访问:
sudo setenforce 0
如果这解决了问题,你需要创建一个适当的SELinux策略来永久允许Jellyfin的网络访问。
启动并启用Jellyfin服务: 启动Jellyfin服务并设置开机自启:
sudo systemctl start jellyfin
sudo systemctl enable jellyfin
配置反向代理(可选但推荐): 为了安全起见,建议通过Nginx或Apache等反向代理服务器来访问Jellyfin。这里以Nginx为例:
sudo dnf install nginx
sudo systemctl start nginx
sudo systemctl enable nginx
/etc/nginx/nginx.conf
或/etc/nginx/conf.d/default.conf
),添加以下内容:server {
listen 80;
server_name your_server_domain_or_ip;
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;
}
}
sudo systemctl restart nginx
远程访问Jellyfin: 现在你可以在浏览器中输入你的服务器IP地址或域名来访问Jellyfin。如果你配置了Nginx反向代理,确保使用的是服务器的IP地址或域名。
安全注意事项:
按照这些步骤,你应该能够在CentOS上成功设置Jellyfin的远程访问。记得在配置过程中检查日志文件(通常位于/var/log/jellyfin/jellyfin.log
)以解决可能出现的问题。
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>