手动安装alist
介绍
alist是一款支持多种存储的目录文件列表程序,支持 web 浏览与 webdav,后端基于gin
,前端使用react
。支持主流网盘挂载并且开源。
项目展示
项目Github地址: alist-org/alist
演示地址:🗂️ Alist演示站 (nn.ci)
安装环境
- 服务器:搭建环境使用的服务器是UCloud块杰型
- 系统:Ubuntu 20.04 LTS
- Oneinstack的LNMP的Nginx环境
- alist v2.6.4
安装
手动安装
手动安装方式[详见文档](手动安装 | Alist Document (nn.ci)),本文记录下在自己服务器上搭建过程,仅供参考
创建网站
由于是Oneinstack的lnmp环境,网站搭建参考管理虚拟主机
获取alist
在AList Release页面下载要部署的系统对应的文件,dpkg --print-architecture
命令查看系统架构,查看后是amd64
,最后下载的文件为alist-linux-amd64.tar.gz,eg:
#进入网站根目录,将压缩包放在此处
cd /data/wwwroot/pan.cjdll.com/
# 下载alist
wget https://github.com/alist-org/alist/releases/download/v2.6.4/alist-linux-amd64.tar.gz
运行起来
# 解压文件得到可执行文件:
tar -zxvf alist-linux-amd64.tar.gz
# 赋予程序执行权限:
chmod +x alist-linux-amd64
# 运行程序,并获得后台登录的初始密码,当然初次使用时,使用 systemctl status alist 也可以初始密码
./alist-linux-amd64
守护进程
vim /etc/systemd/system/alist.service
添加以下内容,其中path_alist
为alist
所在的路径
[Unit]
Description=alist
After=network.target
[Service]
Type=simple
WorkingDirectory=path_alist
ExecStart=path_alist/alist-xxxx -conf data/config.json
Restart=on-failure
[Install]
WantedBy=multi-user.target
然后systemctl daemon-reload
,现在可以使用这些命令来管理程序了:
- 启动:
systemctl start alist
- 关闭:
systemctl stop alist
- 自启:
systemctl enable alist
- 状态:
systemctl status alist
- 重启:
systemctl restart alist
Nginx 反向代理
在网站的配置文件的server字段中加入以下字段
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Range $http_range;
proxy_set_header If-Range $http_if_range;
proxy_redirect off;
proxy_pass http://127.0.0.1:5244;
# 上传的最大文件尺寸
client_max_body_size 20000m;
}
由于是oneinstack的LNMP环境,如果首页出现白屏请尝试注释掉或者删除这些字段:
location ~ [^/]\.php(/|$) {
#fastcgi_pass remote_php_ip:9000;
fastcgi_pass unix:/dev/shm/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|flv|mp4|ico)$ {
expires 30d;
access_log off;
}
location ~ .*\.(js|css)?$ {
expires 7d;
access_log off;
}
location ~ /(\.user\.ini|\.ht|\.git|\.svn|\.project|LICENSE|README\.md) {
deny all;
}
location /.well-known {
allow all;
}
常见问题
如何修改监听端口
程序所在目录的data文件夹下的配置文件:config.json
,修改其中的port值即可。
命令行 ./alist-xxxx -password
查看.(在本例中,在在程序所在目录执行:./alist-linux-amd63 -password
查看)
视频播放不了?有声无画面?有画面无声?
检查一下是不是编码不支持,一般浏览器不支持h.265(hevc)等编码视频,ac3等编码音频,Safari不支持的更多,建议使用软件播放。
现有主流浏览器支持度:
- Chrome(Chromium): 版本104以上将会支持h.265(hevc)PS:目前该版本尚未正式发布
- Microsoft Edge: 新旧内核均支持h.265(hevc),但需额外安装插件
- Mozilla Firefox: 不支持h.265(hevc)
- Apple Safari: 支持h.265(hevc
评论区