Dufs:

一个功能丰富的实用文件服务器,支持静态文件服务、上传、搜索、访问控制、WebDAV 等多种功能。

图片

核心功能:

  • 提供静态文件服务
  • 支持将文件夹打包为 zip 文件下载
  • 允许文件和文件夹上传(支持拖放操作)
  • 支持文件创建、编辑和搜索
  • 支持可恢复的上传和下载
  • 具备访问控制功能
  • 支持 HTTPS 协议
  • 兼容 WebDAV 协议
  • 易于通过 curl 工具使用

安装

Docker Compose

1
2
3
4
5
6
7
8
9
10
services:
dufs:
image: sigoden/dufs:latest
container_name: dufs
command: /data -A
ports:
- 5000:5000
volumes:
- /vol1/1000/docker/dufs/dufs/data:/data
restart: always

参数说明(更多参数建议去看文档)

:::
/data -A(命令):允许 data 目录所有操作

:::

使用

浏览器中输入 http://NAS的IP:5000 就能看到界面

图片

TIP:还有比较多高级功能使用没说到,可以自行查看文档

https://github.com/sigoden/dufs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
Dufs is a distinctive utility file server - https://github.com/sigoden/dufs

Usage: dufs [OPTIONS] [serve-path]

Arguments:
[serve-path] Specific path to serve [default: .]

Options:
-c, --config <file> Specify configuration file
-b, --bind <addrs> Specify bind address or unix socket
-p, --port <port> Specify port to listen on [default: 5000]
--path-prefix <path> Specify a path prefix
--hidden <value> Hide paths from directory listings, e.g. tmp,*.log,*.lock
-a, --auth <rules> Add auth roles, e.g. user:pass@/dir1:rw,/dir2
-A, --allow-all Allow all operations
--allow-upload Allow upload files/folders
--allow-delete Allow delete files/folders
--allow-search Allow search files/folders
--allow-symlink Allow symlink to files/folders outside root directory
--allow-archive Allow zip archive generation
--enable-cors Enable CORS, sets `Access-Control-Allow-Origin: *`
--render-index Serve index.html when requesting a directory, returns 404 if not found index.html
--render-try-index Serve index.html when requesting a directory, returns directory listing if not found index.html
--render-spa Serve SPA(Single Page Application)
--assets <path> Set the path to the assets directory for overriding the built-in assets
--log-format <format> Customize http log format
--log-file <file> Specify the file to save logs to, other than stdout/stderr
--compress <level> Set zip compress level [default: low] [possible values: none, low, medium, high]
--completions <shell> Print shell completion script for <shell> [possible values: bash, elvish, fish, powershell, zsh]
--tls-cert <path> Path to an SSL/TLS certificate to serve with HTTPS
--tls-key <path> Path to the SSL/TLS certificate's private key
-h, --help Print help
-V, --version Print version

简单功能

界面功能还是非常简单,从左到右分别是:下载,上传,创建文件夹,创建文件和搜索

图片

上传文件会显示进度,完成后需要手动刷新才能进行更多操作

图片

NAS 端对应的文件夹,也能看到上传的文件

图片

可以对文件进行:下载,移动,删除和编辑

图片

图片可以作为图床使用(根据文件夹目录结构存放的)

图片

常见的 TXT 文本也可以在线查看

图片

Webdav

自带 Webdav 功能,可以直接进行挂载到本地

图片

TIP:有时候可能提示无效(应该是不太稳定),可以用 RaiDrive 进行挂载

图片

挂载到电脑以后,可以直接进行操作

图片

设置账号

修改“命令”参数

1
/data -a user:pass@/:rw

设置完成,刷新页面就显示要账号和密码才能访问

图片

总结

Dufs 的 UI 界面较为简陋,但对于有能力的用户而言,完全可以自行重写界面。它提供的功能十分实用,且对性能要求不高,即便在配置较弱的小型服务器上也能流畅运行,非常适合作为简单的文件管理器使用。此外,映射路径的文件与网页端显示保持一致,不会打乱原有的文件结构。