使用Syncthing自建私有同步盘教程
![]() | ![]() | ![]() | ![]() |
| 【性价之王】 | 【线路之王】 | 【价格之王】 | 【配置之王】 |
| 【免费之王】 | 【香港首推】 | 【梯子之王】 | 【独服之王】 |

简介
syncthing应该是目前开源界人气最高的一款同步盘程序了,这个主打私有,真的完全私有。。。没有公开分享的功能,并且同步必须要两端相互添加对方许可才行。
毕竟是基于GO开发的,搭建都很简单,并且官方提供了二进制文件,下载即用:
wget https://github.com/syncthing/syncthing/releases/download/v1.0.0/syncthing-linux-amd64-v1.0.0.tar.gztar -xzvf syncthing-linux-amd64-v1.0.0.tar.gzcd syncthing-linux-amd64-v1.0.0cp syncthing /usr/bin| 1234 | wget https://github.com/syncthing/syncthing/releases/download/v1.0.0/syncthing-linux-amd64-v1.0.0.tar.gztar -xzvf syncthing-linux-amd64-v1.0.0.tar.gzcd syncthing-linux-amd64-v1.0.0cp syncthing /usr/bin |
这里我还是按照自己的习惯把程序配置成systemd的服务:
vi /etc/systemd/system/syncthing.service| 1 | vi /etc/systemd/system/syncthing.service |
写入:
[Unit]Description=Syncthing - Open Source Continuous File SynchronizationAfter=network.target[Service]User=rootExecStart=/usr/bin/syncthing -no-restart -logflags=0Restart=on-failureSuccessExitStatus=3 4RestartForceExitStatus=3 4ProtectSystem=fullPrivateTmp=trueSystemCallArchitectures=nativeMemoryDenyWriteExecute=trueNoNewPrivileges=true[Install]WantedBy=default.target| 123456789101112131415161718 | [Unit]Description=Syncthing - Open Source Continuous File SynchronizationAfter=network.target [Service]User=rootExecStart=/usr/bin/syncthing -no-restart -logflags=0Restart=on-failureSuccessExitStatus=3 4RestartForceExitStatus=3 4ProtectSystem=fullPrivateTmp=trueSystemCallArchitectures=nativeMemoryDenyWriteExecute=trueNoNewPrivileges=true [Install]WantedBy=default.target |
然后运行:
systemctl start syncthing| 1 | systemctl start syncthing |
设置开机启动:
systemctl enable syncthing| 1 | systemctl enable syncthing |
因为syncthing默认只监听本地,所以我们要用Nginx做一下反向代理,但是syncthing新版本加入了一个主机头检测的功能,这个要关闭,不然Nginx无法进行反代:
vi ~/.config/syncthing/config.xml| 1 | vi ~/.config/syncthing/config.xml |
在GUI设置的下面加入:
true
如图所示:
然后重启:
| 1 | systemctl restart syncthing |
安装Nginx:
yum -y install nginx| 1 | yum -y install nginx |
新建一个Nginx站点配置文件:
vi /etc/nginx/conf.d/syncthing.conf| 1 | vi /etc/nginx/conf.d/syncthing.conf |
写入:
server { listen 5862; client_max_body_size 100000m; server_name example.com;location /syncthing/ { 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_pass http://127.0.0.1:8384/; proxy_read_timeout 600s; proxy_send_timeout 600s; }}| 1234567891011121314151617 | server { listen 5862; client_max_body_size 100000m; server_name example.com; location /syncthing/ { 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_pass http://127.0.0.1:8384/; proxy_read_timeout 600s; proxy_send_timeout 600s; }} |
这里我把syncthing监听在了5862端口,不是常规端口,因为这个WEBUI初次启动的时候是没有密码验证的,为防止滥用建议监听一个高位端口,后续我们登录进去设置了密码再修改回80都可以的。
现在启动Nginx以及设置开机启动
systemctl start nginxsystemctl enable nginx| 12 | systemctl start nginxsystemctl enable nginx |
现在打开你的站点域名:
http://example.com:5862/syncthing
应该可以访问到这个同步盘的首页:
现在你应该立即给这个WEBUI设置密码:
Windows客户端的话,我个人推荐这个:https://github.com/canton7/SyncTrayzor
下载:https://github.com/canton7/SyncTrayzor/releases/download/v1.1.22/SyncTrayzorSetup-x64.exe
测试了一下功能,可以正常同步:
[资源]历史优惠活动内容
猜你可能想看的VPS
- 疯狂猜成语 图猜成语一个人在举重旁边一个人在搬东西周围是问号是什么成语?全球[VPS测评]
- 脚本 国内 VPS 测评脚本 Superbench.sh 使用教程全球[VPS测评]
- 优惠 桔子 VPS→1 核 1GB 内存 50M 带宽 五折优惠 月付¥全球[VPS测评]
- 疯狂猜成语 图猜成语一座房子前面是海(河)另一座房子前面是田地是什么成语全球[VPS测评]
- 存储型 VPS $2 月 512M 内存 11G NVMe+256G 空虚拟空间(主机)
- 搬瓦工香港最便宜的 vps 方案补货了,1Gbps 带宽,PCCW 直连香港VPS[主机]
- Navicat 导入 mysql 提示 Err 2006-MySQL s全球[VPS测评]
- ExCloud→296 元 月 2G 内存 20GB SSD 空间 6T虚拟空间(主机)
- thinkphp5 中文乱码解决方案全球[VPS测评]
- serverdiscounter→€1 月 1GB 内存 10GB SS虚拟空间(主机)
- 如何让WordPress博客变得更加安全全球[VPS测评]
- VPS推荐:io/zoom美国VPS主机美国VPS[主机]
- 如何在百度搜索结果中显示你的WordPress站点Logo全球[VPS测评]
- RackNerd 便宜VPS春节促销,年付10.88美元起,可选美国洛杉美国VPS[主机]
- upcloud-澳大利亚-1C1G25GB 1TB 7.5$ 月-测评全球[VPS测评]
- DediPath → 1G内存 100G SSD 储存 100Mbps 全球[VPS测评]
- 为什么要拥有一台VPS?全球[VPS测评]
- 很简单的图片不规则布局样式,纯css样式实现的图片瀑布流布局全球[VPS测评]
- 2022年最新的15个美容院抖音文案,美容院文案怎么写全球[VPS测评]
- 创e云:香港CN2VPS优惠专区,4核/4G/20G/2Mbps不限流量香港VPS[主机]
- 九零云怎么样?香港将军澳VPS,美国圣何塞VPS 2核1G10M 47/美国VPS[主机]
- 亿速云“双11”上云狂欢大促 高防云服务器、裸金属服务器优惠套餐全球[VPS测评]
- 海量科技:香港2核2G云服务器,5M独享带宽,低至168元/月香港VPS[主机]
- 拼多多入局跨境电商平台,首站美国;奈雪的茶在上海建第二总部;pidan“美国VPS[主机]
- 老六云怎么样?香港cn2vps月付23元香港NTT月付9.9元香港VPS[主机]
- WordPress去掉分类链接中category目录的两种方法全球[VPS测评]
- 阿里云共享型s6云服务器有没有香港服务器优惠?香港VPS[主机]
- 青云互联:香港安畅弹性云八折,15元/月起;可自定义配置,可选windoWINDOWS
- 8K超高清记录中国空间站凌月:天和核心舱与问天实验舱组成“土”字结构虚拟空间(主机)
- VoLLCloud:香港1核/1G/大带宽VPS,年付赠送1个月,限购限香港VPS[主机]
转载请注明原文地址:http://140.238.13.167:12355/read-31339.html











