本文最后更新于 1064 天前,其中的信息可能已经有所发展或是发生改变。
1、Alist介绍
A file list program that supports multiple storage, powered by Gin and Solidjs.
一个支持多存储的文件列表程序,使用 Gin 和 Solidjs。
Alist官方文档:https://alist.nn.ci/zh/
演示站(官方):https://alist.nn.ci
2、Alist安装
以下指令仅适用于 Linux-x86_64/arm64 平台。
这里以宝塔面板、CentOS作为演示:
登录到宝塔面板后,在左边找到终端,输入账户名、密码、端口号后登录,在命令行输入以下指令:
安装:
curl -fsSL "https://s.nn.ci/alist.sh" | bash -s install
更新:
curl -fsSL "https://s.nn.ci/alist.sh" | bash -s update
卸载:
curl -fsSL "https://s.nn.ci/alist.sh" | bash -s uninstall
自定义路径:
默认安装在 /opt/alist
中。 自定义安装路径,将安装路径作为第二个参数添加,必须是绝对路径(如果路径以alist结尾,则直接安装到给定路径,否则会安装在给定路径alist目录下),如 安装到/root
# Install
curl -fsSL "https://s.nn.ci/alist.sh" | bash -s install /root
# update
curl -fsSL "https://s.nn.ci/alist.sh" | bash -s update /root
# Uninstall
curl -fsSL "https://s.nn.ci/alist.sh" | bash -s uninstall /root
安装好后,找到该域名的设置➡配置文件,将以下配置注释掉或者删除掉:
#禁止访问的文件或目录
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
{
return 404;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
error_log /dev/null;
access_log /dev/null;
}
location ~ .*\.(js|css)?$
{
expires 12h;
error_log /dev/null;
access_log /dev/null;
}
然后在下面添加以下配置:
注意:程序默认监听 5244 端口。如有修改,请一并修改下列配置中的端口号。
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;
# the max size of file to upload
client_max_body_size 20000m;
}
3、添加存储
详情请查看官方文档:通用项 | AList文档
来自安徽