要在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了。