剪藏#NASBox#剪藏

轻量文件服务器 Dufs 部署攻略!低配设备也能流畅运行

2025 年 8 月 26 日1 分钟
分享Twitter / XTelegram微博

如有修改或改动,关注文章底部留言!

教程对你有用,可以 “点赞” 和 “打赏”支持 ~

Notion image

Dufs:

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

Notion image

核心功能:

  • • 提供静态文件服务

  • • 支持将文件夹打包为 zip 文件下载

  • • 允许文件和文件夹上传(支持拖放操作)

  • • 支持文件创建、编辑和搜索

  • • 支持可恢复的上传和下载

  • • 具备访问控制功能

  • • 支持 HTTPS 协议

  • • 兼容 WebDAV 协议

  • • 易于通过 curl 工具使用

安装

Docker Compose

JAVASCRIPT
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就能看到界面

Notion image

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

https://github.com/sigoden/dufs

JAVASCRIPT
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 
JAVASCRIPT
help
  -V, --version              Print version

简单功能

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

Notion image

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

Notion image

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

Notion image

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

Notion image

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

Notion image

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

Notion image

Webdav

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

Notion image

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

Notion image

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

Notion image

设置账号

修改“命令”参数

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

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

Notion image

总结

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

综合推荐:⭐⭐⭐(适合作为小型文件服务器)

使用体验:⭐⭐⭐(界面简陋,功能实用)

部署难易:⭐⭐(简单)︎

原文地址: https://mp.weixin.qq.com/s?__biz=MzI2MjkzMDk3OA==&mid=2247534054&idx=1&sn=0236ca5d2ef0613a806528ccaac89856&chksm=eba4600de858d6c8647ea9ee24b104cdb7a80d1dd6220b5f9fd4f6fce80f00a6bd42d7d101c7&mpshare=1&scene=1&srcid=08260mb5UqqQR2K9r500vHPe&sharer_shareinfo=2952a22c5d78520ec7474c6c88d7b73e&sharer_shareinfo_first=2952a22c5d78520ec7474c6c88d7b73e#rd

相关文章