使用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
- raksmart→美国不限流量服务器(物理机) 100M 带宽~$61 美国VPS[主机]
- 便宜一般-Veesp→$1 月 1 核 512M 100Mbps 宽带 全球[VPS测评]
- js jquery 判断图片是否加载完成的三种方法全球[VPS测评]
- 性价比过低-NexusBytes→$21 年 384MB 内存 5GB 全球[VPS测评]
- 疯狂猜成语 图猜成语一把尺子上面一个入一个出是什么成语?全球[VPS测评]
- 标准互联→新上特惠型美国裸金属服务器 8 核 32G 32ip 1G 带美国VPS[主机]
- php 数组相加合并函数 多个数组相同键名项键值相加。全球[VPS测评]
- KdaCloud→3878 元 月 2 核 4GB 内存 40GB 空间虚拟空间(主机)
- 便宜 cloudcone 最新促销→1 核 512M 内存 10G 硬盘全球[VPS测评]
- 傲游主机春季促销→全场 75 折 XEN KVM 香港&日本&韩国&新加日本VPS[主机]
- php 多个数组根据指定键值分组方法全球[VPS测评]
- INXY→提供 Leaseweb ahCDN UCDN Highwind香港VPS[主机]
- PHP 获取当前 url 的函数全球[VPS测评]
- 通过whos.amung.us实时统计WordPress博客在线人数全球[VPS测评]
- RackNerd美国便宜 VPS 四月促销,$13.89起/年,可选美国美国VPS[主机]
- DigitalVirt → 11¥ 月 美国洛杉矶9929 1C512M美国VPS[主机]
- GreenCloudVPS → 美国欧洲存储型 → 2G 500G 美国VPS[主机]
- 购买香港服务器需要做哪些准备香港VPS[主机]
- WordPress去掉分类链接中category目录的两种方法全球[VPS测评]
- 快速云:云计算分类和云计算的特点全球[VPS测评]
- 搬瓦工:美国香港cn2 gia线路VPS,10Gbps带宽,移动+联通企美国VPS[主机]
- 又一跨境电商产业园落户!中山石岐签约引进16个项目全球[VPS测评]
- 免备案服务器对权重和网站排名有影响吗?全球[VPS测评]
- 印象云怎么样?85折香港安畅CN2vps带宽3M月付23元香港VPS[主机]
- tudcloud:全场7折,香港不限流量VPS,Windows系统,LiWINDOWS
- 阁天互联怎么样?香港cn2云服务器 圣何塞cn2vps仅20/月香港VPS[主机]
- 春天的风最容易温暖心灵,适合朋友圈和抖音的12条文案全球[VPS测评]
- 向日葵-漏洞科普:海外云服务器三种漏洞修复方法快收藏起来!全球[VPS测评]
- 什么是VPS?国内VPS有哪些?全球[VPS测评]
- 天生云:香港沙田CN2 GIA VPS,1核1G40G/2M带宽,月付8香港VPS[主机]
转载请注明原文地址:http://140.238.13.167:12355/read-24855.html











