在CentOS上限制Jellyfin的访问权限,可以通过多种方式实现,包括使用防火墙规则、配置HTTP基本认证、使用反向代理服务器(如Nginx或Apache)等。以下是一些常见的方法:
方法一:使用防火墙规则
-
安装并启用防火墙(如果尚未安装):
sudo yum install firewalld sudo systemctl start firewalld sudo systemctl enable firewalld -
允许Jellyfin使用的端口(默认是8096):
sudo firewall-cmd --permanent --add-port=8096/tcp sudo firewall-cmd --reload -
限制访问IP: 如果你只想允许特定的IP地址访问Jellyfin,可以使用以下命令:
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.100" port protocol="tcp" port="8096" accept' sudo firewall-cmd --reload
方法二:配置HTTP基本认证
-
安装Apache HTTP服务器(如果尚未安装):
sudo yum install httpd sudo systemctl start httpd sudo systemctl enable httpd -
启用必要的模块:
sudo systemctl enable httpd.service sudo systemctl start httpd.service sudo systemctl status httpd.service sudo systemctl restart httpd.service -
创建一个密码文件: 使用
htpasswd工具创建一个密码文件:sudo htpasswd -c /etc/httpd/conf.d/jellyfin.passwd your_username系统会提示你输入并确认密码。
-
配置Apache虚拟主机: 编辑Apache配置文件(例如
/etc/httpd/conf.d/jellyfin.conf),添加以下内容::80 > ServerName your_jellyfin_domain_or_ip ProxyPass / http://localhost:8096/ ProxyPassReverse / http://localhost:8096/AuthType Basic AuthName "Restricted Access" AuthUserFile /etc/httpd/conf.d/jellyfin.passwd Require valid-user -
重启Apache服务器:
sudo systemctl restart httpd
方法三:使用Nginx作为反向代理
-
安装Nginx(如果尚未安装):
sudo yum install nginx sudo systemctl start nginx sudo systemctl enable nginx -
配置Nginx: 编辑Nginx配置文件(例如
/etc/nginx/conf.d/jellyfin.conf),添加以下内容:server { listen 80; server_name your_jellyfin_domain_or_ip; location / { auth_basic "Restricted Access"; auth_basic_user_file /etc/nginx/.htpasswd; 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; } } -
创建密码文件: 使用
htpasswd工具创建一个密码文件:sudo htpasswd -c /etc/nginx/.htpasswd your_username -
重启Nginx服务器:
sudo systemctl restart nginx
通过以上方法,你可以有效地限制Jellyfin的访问权限,确保只有授权用户才能访问你的媒体服务器。
以上就是关于“centos如何限制jellyfin的访问权限”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm