deploy.cc自托管应用部署手册

Syncthing 部署教程:Docker Compose + 反向代理

去中心化的多设备文件同步工具,无需中心服务器。

一句话总结:去中心化的多设备文件同步工具,无需中心服务器。本页给出官方来源的 Docker Compose 部署方式,数据放在 /opt/syncthing,Web 端口只监听 127.0.0.1,经 Nginx / Caddy 反代对外。

服务器配置
官方未给出明确最低配置;本站通用建议:1 核 / 1 GB 内存起(非官方数据)
端口
8384 (Web 管理界面);22000 (同步(TCP/UDP));21027/udp (局域网发现)
CPU 架构
镜像提供 amd64 / arm64(按镜像 manifest 核对于 2026-11-14)
一键安装
curl -fsSL https://deploy.cc/i/syncthing.sh -o syncthing.sh && sudo bash syncthing.sh --domain example.com
官方来源
github.com/syncthing/syncthing/blob/main/README-Docker.md
最后核对
2026-11-13 · 配置已校验
网盘与文件配置已校验1 核 / 1 GB 内存起

简介与官方链接

简介
去中心化的多设备文件同步工具,无需中心服务器。
源码 / 项目
github.com/syncthing/syncthing
官方文档
docs.syncthing.net
部署来源
github.com/syncthing/syncthing/blob/main/README-Docker.md 核对于 2026-11-13
核验程度
配置已校验 docker compose config 校验通过,所有镜像标签确认存在;未实际启动
端口
8384 Web 管理界面
22000 同步(TCP/UDP)
21027/udp 局域网发现

服务器配置要求

官方说明

官方文档未给出明确的最低配置。

本站建议的 VPS 规格

1 核 / 1 GB 内存起,系统建议 Debian 12 / Ubuntu 24.04,已安装 Docker。
本站通用建议,非官方数据。

VPS 推荐位(预留,未启用)

方式一:一键安装脚本(可选)

把下面的 compose 写入 /opt/syncthing 并启动;先核对 sha256 再运行。 脚本做了什么

curl -fsSL https://deploy.cc/i/syncthing.sh -o syncthing.sh
sha256sum syncthing.sh   # f8a3a419d6846a4f67249bb6b924fffe12c619fa2b2b2f946c62d4a3225f6d65
less syncthing.sh
sudo bash syncthing.sh --domain example.com

sha256: f8a3a419d6846a4f67249bb6b924fffe12c619fa2b2b2f946c62d4a3225f6d65 · 启动前检查端口: 8384/tcp 21027/udp 22000/tcp

方式二:手动 docker-compose

保存到 /opt/syncthing,替换 .env 中的 __GEN_…__ 后 docker compose up -d。

相对官方示例的改动:同步目录 /wherever/st-sync 改为 ./sync。
/opt/syncthing/docker-compose.yml官方来源 · raw
# Syncthing — docker-compose.yml (deploy.cc)
# 官方来源 / Official source: https://github.com/syncthing/syncthing/blob/main/README-Docker.md
# 核对日期 / Checked: 2026-11-13
# 改动: 同步目录 /wherever/st-sync 改为 ./sync
services:
  syncthing:
    image: syncthing/syncthing:latest
    hostname: my-syncthing
    environment:
      - PUID=1000
      - PGID=1000
      - STGUIADDRESS=
    volumes:
      - ./sync:/var/syncthing
    network_mode: host
    restart: unless-stopped
    healthcheck:
      test: curl -fkLsS -m 2 127.0.0.1:8384/rest/noauth/health | grep -o --color=never OK || exit 1
      interval: 1m
      timeout: 10s
      retries: 3
  • 官方示例使用 host 网络。首次进入 Web 界面后请立即设置 GUI 用户名和密码。
  • 通过域名反代访问 GUI 时,Syncthing 会检查 Host 头,需要在设置里配置或按官方文档处理。

环境变量

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

反向代理与 HTTPS

应用只监听 127.0.0.1:8384,用 Nginx 或 Caddy 对外提供 HTTPS。需要限流、缓存等更多选项可用 nginx.cc 配置生成器。

/etc/nginx/conf.d/syncthing.confNginx
# Syncthing 反向代理 / 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 0;

    location / {
        proxy_pass http://127.0.0.1:8384;
        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(自动申请证书)

/etc/caddy/CaddyfileCaddy
# Syncthing — Caddyfile (deploy.cc). Caddy 会自动申请 HTTPS 证书 / automatic HTTPS
example.com {
    reverse_proxy 127.0.0.1:8384
}

更新、备份与卸载

更新
cd /opt/syncthing
docker compose pull
docker compose up -d
docker image prune -f

大版本升级前请先备份,并阅读官方更新说明。

备份(整个目录打包,含数据和 .env)
cd /opt/syncthing && docker compose stop
tar czf /root/syncthing-$(date +%F).tar.gz -C /opt syncthing
cd /opt/syncthing && docker compose start
卸载
cd /opt/syncthing && docker compose down
# 下面这行会永久删除所有数据,确认已备份再执行
# rm -rf /opt/syncthing

常见问题

Syncthing 是什么?

去中心化的多设备文件同步工具,无需中心服务器。官方仓库:https://github.com/syncthing/syncthing

部署 Syncthing 需要什么配置的服务器?

官方未给出明确最低配置;本站通用建议:1 核 / 1 GB 内存起(非官方数据)

Syncthing 使用哪些端口?

8384 (Web 管理界面);22000 (同步(TCP/UDP));21027/udp (局域网发现)。Web 端口只监听 127.0.0.1,通过 Nginx 或 Caddy 反向代理对外提供 HTTPS。

Syncthing 能在 ARM(arm64)服务器上运行吗?

可以。本页 compose 用到的镜像(syncthing/syncthing:latest)都提供 arm64 版本(按镜像 manifest 核对于 2026-11-14)。

怎样一键安装 Syncthing?

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

Syncthing 的数据存在哪里?怎么备份?

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

怎样更新 Syncthing?

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

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

来源:https://github.com/syncthing/syncthing/blob/main/README-Docker.md。改动:同步目录 /wherever/st-sync 改为 ./sync。

纯文本版本(适合复制或给 AI 工具引用):/zh/apps/syncthing.md

同类应用