蛮子哥 蛮子哥
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)

蛮子哥

业精于勤,荒于嬉
首页
  • linux
  • windows
  • 中间件
  • 监控
  • 网络
  • 存储
  • 安全
  • 防火墙
  • 数据库
  • 系统
  • docker
  • 运维工具
  • other
  • elk
  • K8S
  • ansible
  • Jenkins
  • GitLabCI_CD
  • 随笔
  • 面试
  • 工具
  • 收藏夹
  • Shell
  • python
  • golang
友链
  • 索引

    • 分类
    • 标签
    • 归档
    • 首页 (opens new window)
    • 关于我 (opens new window)
    • 图床 (opens new window)
    • 评论 (opens new window)
    • 导航栏 (opens new window)
周刊
GitHub (opens new window)
  • linux

    • rsync

      • rsync用法及参数详解
      • rsync服务实现推送,拉取
    • dns

    • sed、awk、grep、find四剑客

    • LVM管理
    • sudo权限规划
    • linux修改网卡为eth0的两种方法
    • Logrotate入门了解及生产实践
    • linux中用dd命令来测试硬盘读写速度
    • linux 阿里云盘挂载错误
    • CentOS7安装Android SDK
    • centos7安装更新git
    • linux启动顺序
    • centos7升级openssl
    • expect工具的安装和使用方法
    • linux下使用v2ray
    • centos7安装java环境的两种方式
    • linux-centos7系统设置时区及同步时间
    • rsyslog日志系统:rsyslog配置文件
    • rsyslog的安装、使用、详解
    • safe-rm防止删除重要的文件
    • linux如何获取打开文件和文件描述符数量
    • LVS集群-DR模式
    • linux服务器安装ffmpeg
    • linux服务器安装samba
    • 使用openssl创建自签发证书
    • linux服务器部署next.js服务
    • linux服务器ionice命令使用方式
    • linux服务器curl命令常用操作
    • linux服务器修改终端会话时间的操作
    • linux服务器执行远程命令几种方式
    • 快速搭建上传和下载页面
  • windows

  • 中间件

  • 网络

  • 安全

  • 存储

  • 防火墙

  • 数据库

  • 系统

  • docker

  • other

  • 监控

  • 运维
  • linux
蛮子哥
2026-01-08

快速搭建上传和下载页面

# 快速启动命令

docker run -itd --name dufs -v `pwd`:/data -p 5000:5000 docker.cnb.cool/znb/images/dufs /data -A
1
  • 如果需要使用子路径反向代理,执行下面操作
docker run -itd --name dufs -v `pwd`:/data -p 5000:5000 docker.cnb.cool/znb/images/dufs /data --path-prefix /dufs -A
1
  • github开源系统链接 https://github.com/sigoden/dufs

# 配置nginx代理

server {
    listen 80;
    # 将 your-domain.com 替换为你的实际域名或 IP
    server_name your-domain.com; 

    # 访问日志和错误日志(可选)
    access_log /var/log/nginx/dufs_access.log;
    error_log /var/log/nginx/dufs_error.log;

    # 核心配置
    location / {
        # dufs 默认运行在 5000 端口
        proxy_pass http://127.0.0.1:5000; 

        # --- 基础代理头信息 ---
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # --- 关键配置:解除上传大小限制 ---
        # Nginx 默认限制为 1M,这会导致大文件上传失败 (413 Request Entity Too Large)
        # 设置为 0 表示不限制大小,或者你可以设置为具体数值,如 10G
        client_max_body_size 0; 

        # --- 连接与超时设置 ---
        # 很多大文件传输需要较长时间,增加超时时间防止中断
        proxy_connect_timeout 300s;
        proxy_send_timeout 300s;
        proxy_read_timeout 300s;

        # --- WebSocket 支持 (可选但推荐) ---
        # 虽然 dufs 主要是 HTTP,但保持良好的协议支持是最佳实践
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        # --- 禁用缓存 (可选) ---
        # 对于文件管理服务,通常希望看到最新状态,防止 Nginx 缓存干扰
        proxy_buffering off;
    }
}
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
34
35
36
37
38
39
40
41
42
  • 子路径反向代理
    location /dufs/ {
        # 1. 代理到 dufs 端口
        # 注意:这里 IP 后面不要加斜杠!不要写成 http://127.0.0.1:5000/
        proxy_pass http://127.0.0.1:5000; 

        # 2. 必须的 Header 设置
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        # 3. 解除上传限制 (防止大文件上传失败)
        client_max_body_size 0;

        # 4. 优化连接超时 (防止大文件传输中断)
        proxy_connect_timeout 300s;
        proxy_send_timeout 300s;
        proxy_read_timeout 300s;

        # 5. 关闭缓冲 (可选,推荐)
        proxy_buffering off;
    }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
微信 支付宝
上次更新: 2026/01/08, 14:46:12

← linux服务器执行远程命令几种方式 windows支持多用户远程登录→

最近更新
01
自动化CICD部署示例展示一
01-20
02
OpenCode-CLI配置
01-15
03
通用项目架构模板
01-14
更多文章>
Theme by Vdoing | Copyright © 2019-2026 | 点击查看十年之约 | 鄂ICP备2024072800号
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式