[deepin exploration] 局域网共享文件 WebDav + Http 服务器 工具分享
Tofloor
poster avatar
神末shenmo
deepin
Spark-App
Solutions Team Moderator
2025-02-27 18:45
Author

https://gitee.com/shenmo7192/momo-and-mox-tool-scripts/blob/master/server.py

上次更新:

[应用分享] 局域网共享文件的好帮手:python http/webdav server

更新内容

python3 server.py -h

usage: server.py [-h] [-b BIND] [-d DIRECTORY] [-p {http,webdav}] [--cgi] [--auth AUTH] [port]

Run a simple HTTP or WebDAV server.

positional arguments:
  port                  Port to listen on (default: 8000)

options:
  -h, --help            show this help message and exit
  -b BIND, --bind BIND  Address to bind to (default: 0.0.0.0)
  -d DIRECTORY, --directory DIRECTORY
                        Directory to serve (default: current directory)
  -p {http,webdav}, --protocol {http,webdav}
                        Protocol version (default: http)
  --cgi                 Enable CGI
  --auth AUTH           Authentication credentials (user:pass)

最简单的使用方法: python3 ./server.py

效果:在 8000 端口 开一个 http 服务端

图片.png

稍微进阶的使用方法:在最简单的方法基础上

  • 添加 -d :指定文件服务器的根目录
  • 添加 -p :可跟 http 或者 webdav 指定开启的服务类型。若不加默认是 http
  • 添加 --auth :格式为 用户名:密码 添加密码验证
  • -b --cgi 暂无法使用

如果需要 https 建议套个 nginx 反代

若需要作为上传服务反代,请添加以下nginx参数,分别是延长超时时长,禁用包大小限制和禁用请求缓存

proxy_read_timeout 3600s;
client_max_body_size 0;
proxy_request_buffering off;
Reply Favorite View the author
All Replies
观察者
deepin
2025-02-27 21:14
#1

dufs 如何?

Reply View the author
neko
deepin
Ecological co-builder
Resources Team Moderator
2025-02-28 08:17
#2

也用tailsacle😏

Reply View the author