在Ubuntu上配置Jellyfin媒体服务器的步骤如下:
sudo apt update
sudo apt upgrade -y
sudo apt install apt-transport-https ca-certificates curl -y
mkdir -p /etc/apt/keyrings
curl -fsSL https://repo.jellyfin.org/jellyfin_team.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/jellyfin.gpg
cat <<EOF | sudo tee /etc/apt/sources.list.d/jellyfin.sources
deb [arch=$(dpkg --print-architecture)] https://repo.jellyfin.org/ubuntu $(lsb_release -cs) main
EOF
sudo apt update
sudo apt install jellyfin -y
sudo systemctl start jellyfin
sudo systemctl enable jellyfin
在浏览器中输入服务器的IP地址,通常是 http://<你的服务器IP>:8096
。首次访问时,你需要创建一个管理员账户并添加媒体库。
sudo apt install ufw -y
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw status
mkdir -p /var/www/html/jellyfin/public_html
chown -R www-data:www-data /var/www/html/jellyfin/public_html
sudo certbot certonly --agree-tos --email your_email@example.com --no-eff-email --webroot -w /var/www/html -d your_domain
sudo nano /etc/apache2/sites-available/jellyfin.conf
在文件中插入以下内容,根据需要更改域名和SSL证书路径:
<VirtualHost *:80>
ServerName your_domain
Redirect permanent / https://your_domain/
ErrorLog ${APACHE_LOG_DIR}/your_domain-error.log
CustomLog ${APACHE_LOG_DIR}/your_domain-access.log combined
</VirtualHost>
<VirtualHost *:443>
ServerName your_domain
DocumentRoot /var/www/html/jellyfin/public_html
ProxyPreserveHost On
ProxyPass "/.well-known/" "!"
RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
ProxyPass "/socket" "ws://0.0.0.0:8096/socket"
ProxyPassReverse "/socket" "ws://0.0.0.0:8096/socket"
ProxyPass "/" "http://0.0.0.0:8096/"
ProxyPassReverse "/" "http://0.0.0.0:8096/"
</VirtualHost>
sudo a2enmod proxy proxy_http ssl proxy_wstunnel remoteip http2 headers
sudo systemctl restart apache2
以上步骤应该可以帮助你在Ubuntu上成功安装和配置Jellyfin媒体服务器。如果在配置过程中遇到任何问题,请参考Jellyfin的官方文档或寻求社区帮助。