https://github.com/sigoden/dufs
由于在windows上始终无法通过nssm/winsw等工具将dufs注册成系统服务,因此博主已经放弃,目前使用hfs来代替:HFS-文件服务器 - 代号尚行 (claves.cn)
「Dufs」是一款简单的文件服务器, 支持静态文件服务、上传、搜索、访问控制、webdav 等,用 Rust 编写,单可执行文件,主要功能如下:
- 静态文件服务
- 下载目录为 zip 文件
- 上传文件 /目录 (支持拖拽)
- 搜索文件
- 并发下载,断续下载
- 路径级别的访问控制
- 支持 https
- 支持 webdav
- 方便 curl 调用
启动帮助:
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 <config> 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
--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
常见启动命令:
dufs D:/ --bind=0.0.0.0 --port=80 --auth=admin:123@/:rw --allow-delete --allow-search --allow-archive
# 解释:添加了用户名、密码;允许删除文件;允许搜索文件;允许打包文件;