Alist挂载阿里云盘程序搭建手册

官方文档地址:https://alist-doc.nn.ci/docs/intro

Alist是一款支持多种存储的目录文件列表程序,支持 web 浏览与 webdav,后端基于gin,前端使用react。

支持的存储

一、安装、更新与卸载

直接使用一键脚本即可

# 安装
curl -fsSL "https://nn.ci/alist.sh" | bash -s install 绝对路径
# 更新
curl -fsSL "https://nn.ci/alist.sh" | bash -s update 绝对路径
# 卸载
curl -fsSL "https://nn.ci/alist.sh" | bash -s uninstall 绝对路径

二、反向代理

程序默认监听5244端口

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_redirect off;
    proxy_pass http://127.0.0.1:5244;
    # 上传的最大文件尺寸
    client_max_body_size 20000m;
}

如果使用宝塔,请务必删除以下默认配置

  • location ~ ^/(.user.ini|.htaccess|.git|.svn|.project|LICENSE|README.md
  • location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
  • location ~ .*.(js|css)?$

Apache

在VirtualHost字段下加入反代配置项ProxyPass,比如:

<VirtualHost *:80>
    ServerName myapp.example.com
    ServerAdmin webmaster@example.com
    DocumentRoot /www/myapp/public

    AllowEncodedSlashes NoDecode
    ProxyPass "/" "http://127.0.0.1:5244/" nocanon
</VirtualHost>

Caddy

在Caddyfile文件下加入反代配置项reverse\_proxy,比如:

:80 {
    reverse_proxy 127.0.0.1:5244
}

三、常用命令

访问地址:http://YOUR_IP:5244/

配置文件:/绝对路径/alist/data/config.json
初始管理密码:iJMwpXx5

查看状态:systemctl status alist
启动服务:systemctl start alist
重启服务:systemctl restart alist
停止服务:systemctl stop alist

四、挂载阿里云盘

由于阿里云盘referrer的限制,必须使用移动端token,使用桌面web端token会导致无法下载与预览。

refresh\_token(刷新令牌)

获取地址:https://alist-doc.nn.ci/docs/driver/aliyundrive/

排序与排序方向

自行选择,或者不选

根目录file_id

打开阿里云盘官网,点进去你要设置的文件夹时url后面的一串。

限制

如果你的服务器与阿里云盘的服务器通信困难,可选择填小一点,否则默认不填就好

五、Webdav

webdav支持将阿里云盘挂载到本地实现列表、下载、创建文件夹、重命名、移动、上传操作。

链接 https://domain:port/dav/
主机 domain:port
路径 dav
协议 http/https
端口 同 web 端口
账号 后台可设置
密码 后台可设置