Docker安装Alist

1.安装

1.docker-cli
1
docker run -d --restart=always -v /etc/alist:/opt/alist/data -p 5244:5244 -e PUID=0 -e PGID=0 -e UMASK=022 --name="alist" xhofe/alist:latest
2.docker-compose
1
2
3
4
5
6
7
8
9
10
11
12
13
14
version: '3.3'
services:
alist:
restart: always
volumes:
- '/etc/alist:/opt/alist/data'
ports:
- '5244:5244'
environment:
- PUID=0
- PGID=0
- UMASK=022
container_name: alist
image: 'xhofe/alist:latest'
3.查看管理员信息
1
docker exec -it alist ./alist admin

2.反向代理

1.配置文件

打开config.json,编辑site_url字段。

改为自己的网站 URL,比如https://pan.xxx.com,这个地址会在程序中的某些地方使用,如果不设置这个字段,一些功能可能无法正常工作,比如

  • 本地存储的缩略图
  • 开启 web 代理后的预览
  • 开启 web 代理后的下载地址
  • 反向代理至二级目录

URL 链接结尾请勿携带 / ,参照如下示例,否则也将无法使用上述功能或出现异常

1
2
3
4
# 正确写法:
"site_url": "https://pan.xxx.com",
# 错误写法:
"site_url": "https://pan.xxx.com/",
2.Nginx

在网站配置文件的 server 字段中添加

1
2
3
4
5
6
7
8
9
10
11
12
13
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;
#修改为本机IP,docker网络模式为host则无需修改
# the max size of file to upload
client_max_body_size 20000m;
}

Docker安装Alist
https://kuan.pages.dev/article/58101361.html
作者
IKun
发布于
2023年1月25日
许可协议