在Ubuntu系统下设置Jellyfin的安全性是一个重要的步骤,以确保媒体服务器的稳定性和用户数据的安全。以下是一个详细的安全设置指南:
首先,确保你的Ubuntu系统是最新的:
sudo apt update
sudo apt upgrade -y
安装Jellyfin和其他必要的软件包:
sudo apt install jellyfin
为了提高安全性,建议为Jellyfin创建一个专用用户:
sudo adduser jellyfin --system --group --disabled-login --no-create-home
使用UFW(Uncomplicated Firewall)来限制对Jellyfin服务的访问:
sudo apt install ufw -y
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw allow "WWW Full"
sudo ufw status
为Jellyfin配置SSL证书,启用HTTPS:
sudo apt install certbot python3-certbot-apache -y
sudo certbot certonly --agree-tos --email your_email@example.com --no-eff-email --webroot -w /var/www/html -d your_domain
编辑Jellyfin的配置文件 /etc/jellyfin/config.xml
,确保以下设置:
jellyfin
有权限访问和管理Jellyfin。使用Nginx作为反向代理来处理HTTPS请求:
sudo apt install nginx -y
sudo a2enmod proxy proxy_http ssl proxy_wstunnel remoteip http2 headers
sudo systemctl restart apache2
编辑Nginx配置文件 /etc/apache2/sites-available/jellyfin.conf
:
<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://localhost:8096/socket"
ProxyPassReverse "/socket" "ws://localhost:8096/socket"
ProxyPass "/" "http://localhost:8096/"
ProxyPassReverse "/" "http://localhost:8096/"
</VirtualHost>
重启Nginx:
sudo systemctl restart apache2
启动Jellyfin服务并设置为开机自启动:
sudo systemctl start jellyfin
sudo systemctl enable jellyfin
通过浏览器访问Jellyfin的管理界面(例如:http://your_server_ip:8096
),确保所有设置正确无误。
定期更新Jellyfin到最新版本,以确保所有已知的安全漏洞都得到修复:
sudo apt update
sudo apt upgrade jellyfin -y
通过以上步骤,你可以在Ubuntu系统下为Jellyfin设置一个基本的安全环境。根据具体需求,你可能还需要进一步调整防火墙规则、启用硬件加速等。