ubuntu

ubuntu系统下jellyfin安全设置指南

小樊
44
2025-05-28 12:43:03
栏目: 智能运维

在Ubuntu系统下设置Jellyfin的安全性是一个重要的步骤,以确保媒体服务器的稳定性和用户数据的安全。以下是一个详细的安全设置指南:

1. 更新系统和软件包

首先,确保你的Ubuntu系统是最新的:

sudo apt update
sudo apt upgrade -y

2. 安装必要的软件包

安装Jellyfin和其他必要的软件包:

sudo apt install jellyfin

3. 创建Jellyfin用户

为了提高安全性,建议为Jellyfin创建一个专用用户:

sudo adduser jellyfin --system --group --disabled-login --no-create-home

4. 配置防火墙

使用UFW(Uncomplicated Firewall)来限制对Jellyfin服务的访问:

sudo apt install ufw -y
sudo ufw allow OpenSSH
sudo ufw enable
sudo ufw allow "WWW Full"
sudo ufw status

5. 配置SSL证书

为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

6. 配置Jellyfin

编辑Jellyfin的配置文件 /etc/jellyfin/config.xml,确保以下设置:

7. 设置反向代理(可选)

使用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

8. 启动Jellyfin服务

启动Jellyfin服务并设置为开机自启动:

sudo systemctl start jellyfin
sudo systemctl enable jellyfin

9. 验证设置

通过浏览器访问Jellyfin的管理界面(例如:http://your_server_ip:8096),确保所有设置正确无误。

10. 定期更新

定期更新Jellyfin到最新版本,以确保所有已知的安全漏洞都得到修复:

sudo apt update
sudo apt upgrade jellyfin -y

通过以上步骤,你可以在Ubuntu系统下为Jellyfin设置一个基本的安全环境。根据具体需求,你可能还需要进一步调整防火墙规则、启用硬件加速等。

0
看了该问题的人还看了