使用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
- DiyVM→69 元 月 XEN-2GB 50GB 8M 洛杉矶(CN2全球[VPS测评]
- Wholesaleinternet→独立服务器月付 10 美元起 100独立服务器[U]
- VULTR→新用户送 100 美元 KVM 16 个机房 支持支付宝微信全球[VPS测评]
- 促销 RackNerd 网站改版优惠→三款特价 VPS 1.5G 内存套全球[VPS测评]
- 0 元购 酷番云→1 核 1G 60G 硬盘 2M 带宽 内蒙机房邀请好全球[VPS测评]
- 华为云→香港 北京 上海 广州等云速建站 不限流量 8GB 空间 年付 虚拟空间(主机)
- textarea 宽度自适应全球[VPS测评]
- SkylonHost→€4.99 月 2 核 3GB 内存 35GB S虚拟空间(主机)
- 企鹅小屋→350 元 月 E3-12XX 16GB 内存 1TB 硬盘 香港VPS[主机]
- WordPress插件:WP Downgrade降级到旧版本或者升级到新全球[VPS测评]
- 如何为WordPress网站站外链接添加自动nofollow功能全球[VPS测评]
- 如何防止google voice被回收全球[VPS测评]
- WordPress网站搜索结果只有一篇文章代码实现自动跳转到该文章全球[VPS测评]
- Buyvm拉斯维加斯和卢森堡机房 VPS 补货,$3.5起/月,AMD 全球[VPS测评]
- DMIT黑五日本CN2GIA云服务器八折;洛杉矶/香港/东京国际线路新订日本VPS[主机]
- DMIT.io 香港VPS CVM N3系列香港VPS[主机]
- 如何根据业务需求选择合适的云服务器配置?全球[VPS测评]
- 云服务器和服务器各有什么优缺点?全球[VPS测评]
- 关键路径、资金情况、政策关键数据中心的可持续发展路径在哪里?全球[VPS测评]
- 8K超高清记录中国空间站凌月:天和核心舱与问天实验舱组成“土”字结构虚拟空间(主机)
- 8K超高清记录中国空间站凌月:天和核心舱与问天实验舱组成“土”字结构虚拟空间(主机)
- SugarHosts糖果主机双十一大促销 虚拟主机最高6折优惠全球[VPS测评]
- tudcloud,香港沙田大带宽vps特惠7折,CN2+BGP直连,10香港VPS[主机]
- 金斗云怎么样?香港CN2月付23元,圣何塞CN2月付22元香港VPS[主机]
- 菠萝云服务器怎么样?香港云主机BGP、CN2,2核1G2M带宽仅49元/香港VPS[主机]
- 者也IO,香港日本美国云服务器促销,2核2G1000元/2年,7折+内存日本VPS[主机]
- 如何设置必应api 自动推送网站全球[VPS测评]
- CYUN:开工促销,香港云服务器/美国高防vps/香港物理服务器85折美国VPS[主机]
- 双翼鸟数据:香港cn2云服务器低至28元/月起;美国高防vps仅56元/美国VPS[主机]
- Mineserver:香港CMI大带宽云服务器38元/月起(300M不限香港VPS[主机]
转载请注明原文地址:http://140.238.13.167:12355/read-31339.html











