# qBittorrent — 部署教程（Docker Compose + 反向代理）

> 开源 BT 下载客户端，带 Web 管理界面。请只下载你有权下载的内容。

- 页面: https://deploy.cc/zh/apps/qbittorrent
- 分类: 影音媒体
- 服务器配置: 官方未给出明确最低配置；本站通用建议：1 核 / 1 GB 内存起（非官方数据）
- 端口: 8088 (Web 界面)；6881 (BT 监听（TCP/UDP）)
- CPU 架构: 镜像提供 amd64 / arm64（按镜像 manifest 核对于 2026-11-14）
- 一键安装: `curl -fsSL https://deploy.cc/i/qbittorrent.sh -o qbittorrent.sh && sudo bash qbittorrent.sh --domain example.com` (sha256 63c006ea3d5d8d63d2124943f4ab741a066d4083deb42bccf3898ec5866953e3)
- 官方仓库: https://github.com/qbittorrent/qBittorrent
- 官方文档: https://github.com/qbittorrent/qBittorrent/wiki
- 部署来源: https://github.com/linuxserver/docker-qbittorrent
- 核验程度: 配置已校验（compose config 通过、镜像存在，未启动）
- 最后核对: 2026-11-13

## docker-compose.yml (/opt/qbittorrent)

```yaml
# qBittorrent — docker-compose.yml (deploy.cc)
# 官方来源 / Official source: https://github.com/linuxserver/docker-qbittorrent
# 核对日期 / Checked: 2026-11-13
# 改动: Web 端口改为 8088（WEBUI_PORT 与映射保持一致）并只监听 127.0.0.1
# 改动: 目录改为 ./config ./downloads
services:
  qbittorrent:
    image: lscr.io/linuxserver/qbittorrent:latest
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=${TZ:-Asia/Shanghai}
      - WEBUI_PORT=8088
      - TORRENTING_PORT=6881
    volumes:
      - ./config:/config
      - ./downloads:/downloads
    ports:
      - "127.0.0.1:8088:8088"
      - "6881:6881"
      - "6881:6881/udp"
    stop_grace_period: "10s"
    restart: unless-stopped
```

## .env

```bash
# qBittorrent — deploy.cc .env 模板 / template
# __GEN_*__ 由一键脚本替换为随机值；手动部署请自己改掉。
TZ=Asia/Shanghai
```

## 注意

- 镜像由 LinuxServer.io 维护。首次启动的临时密码打印在日志里：docker compose logs qbittorrent
- 很多 VPS 商家禁止 BT 下载，使用前请看服务条款。

## Nginx

```nginx
# qBittorrent 反向代理 / reverse proxy — generated by deploy.cc
# 把 example.com 换成你的域名，证书路径按实际修改（certbot / acme.sh 签发）。
# Replace example.com and the certificate paths. More options: https://nginx.cc/zh/gen
# 放到 /etc/nginx/conf.d/<name>.conf，然后 nginx -t && systemctl reload nginx

server {
    listen 80;
    listen [::]:80;
    server_name example.com;

    location /.well-known/acme-challenge/ {
        root /var/www/html;
    }

    location / {
        return 301 https://$host$request_uri;
    }
}

server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;  # nginx < 1.25.1: 删除此行，改为 listen 443 ssl http2;
    server_name example.com;

    ssl_certificate     /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_protocols TLSv1.2 TLSv1.3;

    client_max_body_size 10m;

    location / {
        proxy_pass http://127.0.0.1:8088;
        proxy_http_version 1.1;
        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;
        proxy_read_timeout 300s;
    }
}
```

## Caddy

```caddy
# qBittorrent — Caddyfile (deploy.cc). Caddy 会自动申请 HTTPS 证书 / automatic HTTPS
example.com {
    reverse_proxy 127.0.0.1:8088
}
```

## 更新

```bash
cd /opt/qbittorrent && docker compose pull && docker compose up -d && docker image prune -f
```

## 备份

```bash
cd /opt/qbittorrent && docker compose stop && tar czf /root/qbittorrent-$(date +%F).tar.gz -C /opt qbittorrent && docker compose start
```

## FAQ

### qBittorrent 是什么？

开源 BT 下载客户端，带 Web 管理界面。请只下载你有权下载的内容。官方仓库：https://github.com/qbittorrent/qBittorrent

### 部署 qBittorrent 需要什么配置的服务器？

官方未给出明确最低配置；本站通用建议：1 核 / 1 GB 内存起（非官方数据）

### qBittorrent 使用哪些端口？

8088 (Web 界面)；6881 (BT 监听（TCP/UDP）)。Web 端口只监听 127.0.0.1，通过 Nginx 或 Caddy 反向代理对外提供 HTTPS。

### qBittorrent 能在 ARM（arm64）服务器上运行吗？

可以。本页 compose 用到的镜像（lscr.io/linuxserver/qbittorrent:latest）都提供 arm64 版本（按镜像 manifest 核对于 2026-11-14）。

### 怎样一键安装 qBittorrent？

在 Linux 服务器上以 root 运行：curl -fsSL https://deploy.cc/i/qbittorrent.sh -o qbittorrent.sh && sudo bash qbittorrent.sh --domain example.com。脚本没有 Docker 时会用官方 get.docker.com 安装，把文件写到 /opt/qbittorrent，生成随机密码，然后 docker compose up -d；端口被占用或目录已存在时会停止，不覆盖。

### qBittorrent 的数据存在哪里？怎么备份？

所有数据和 .env 都在 /opt/qbittorrent 目录（绑定挂载）。备份：cd /opt/qbittorrent && docker compose stop && tar czf /root/qbittorrent-$(date +%F).tar.gz -C /opt qbittorrent && docker compose start

### 怎样更新 qBittorrent？

cd /opt/qbittorrent && docker compose pull && docker compose up -d && docker image prune -f。大版本升级前先备份并阅读官方更新说明。

### 这里的 docker-compose 和官方示例有什么不同？

来源：https://github.com/linuxserver/docker-qbittorrent。改动：Web 端口改为 8088（WEBUI_PORT 与映射保持一致）并只监听 127.0.0.1；目录改为 ./config ./downloads。

---
deploy.cc（非官方站点，商标归各自所有者）· v0.2.2
