获取AList
从AList Releases获取适用于你的设备的AList,建议下载musl版本!
安装AList
上传到宝塔面板中,解压到AList目录,然后设置权限和管理员密码
# 授予程序执行权限:
chmod +x alist
# 获得管理员信息 以下两个不同版本,新版本也有随机生成和手动设置
# 低于v3.25.0版本
./alist admin
# 高于v3.25.0版本
# 随机生成一个密码
./alist admin random
# 手动设置一个密码 `NEW_PASSWORD`是指你需要设置的密码
./alist admin set NEW_PASSWORD
运行AList
连接ssh,cd到解压目录,然后执行./alist server
守护进程
进入/usr/lib/systemd/system目录,新建alist.service文件,并添加以下内容,其中 path_alist 为 AList 所在的路径
[Unit]
Description=alist
After=network.target
[Service]
Type=simple
WorkingDirectory=path_alist
ExecStart=path_alist/alist server
Restart=on-failure
[Install]
WantedBy=multi-user.target
然后,执行 systemctl daemon-reload
重载配置,现在你可以使用这些命令来管理程序:
- 启动:
systemctl start alist
- 关闭:
systemctl stop alist
- 配置开机自启:
systemctl enable alist
- 取消开机自启:
systemctl disable alist
- 状态:
systemctl status alist
- 重启:
systemctl restart alist
反向代理
如果不想通过IP+端口访问,可以设置反向代理
在网站配置文件的 server 字段中添加
#AList
location / {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
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;
# the max size of file to upload
client_max_body_size 20000m;
}
宝塔面板用户还需要删除以下代码,直接Ctrl+H查找删除就行
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md
location ~ .\*\.(gif|jpg|jpeg|png|bmp|swf)$
location ~ .\*\.(js|css)?$
至此,整篇文章结束!你可以慢慢配置你的AList了!
© 版权声明
THE END
暂无评论内容