使用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
- racknerd→“五一”便宜年付 VPS $18.88 年 5T 大流全球[VPS测评]
- 阿里云双十一拼团→云服务器年付 86 元起 2C4G3M 三年 799 全球[VPS测评]
- 双十一 微基主机预热活动→韩国机房双 E5-2630L 32G 韩国VPS[主机]
- ByteDynasty→11 元 月 512MB 内存 15GB SSD虚拟空间(主机)
- 便宜 PacificRack 传家套餐→384M 内存套餐$7.25 年全球[VPS测评]
- 上新极光 KVM→美国洛杉矶 PZ 中美优化线路 KVM 123.45 美国VPS[主机]
- hostkvm 香港湾仔机房补货 2G 内存 30G 硬盘每月 68 元香港VPS[主机]
- LOCVPS→38.5 元 月 XEN-2GB 40GB 3M 香港机房香港VPS[主机]
- raksmart→日本不限流量服务器(物理机) 100Mbps 带宽 $日本VPS[主机]
- 便宜 LosAngelesvps→年付$19.5 1 核 1.5G 内存全球[VPS测评]
- 亲库 新人免费 0 元购撸实物全球[VPS测评]
- 腾讯云新春礼包(新老用户均可领取) 新用户秒杀最低 128 元起全球[VPS测评]
- HostKvm 新上洛杉矶CN2VPS 2G内存入门套餐七折终身优惠$6全球[VPS测评]
- HostPost → 4.8$ 月 匈牙利 2C2G20G硬盘 10Gb全球[VPS测评]
- Phanes Cloud → 黑五 2.49€ 月 荷兰 1C1G30G全球[VPS测评]
- owocloud-广州移动独立IP-vps测评独立服务器[U]
- SoyouStart → E3-1225v2 16G 内存 3*2T S全球[VPS测评]
- HKServerSolution → 4G内存 20G SSD 3T流量全球[VPS测评]
- 漂亮的Css3响应侧边栏菜单,动画风格侧边栏导航菜单样式全球[VPS测评]
- JGKVM促销,美国cn2vps服务器价格再创新低,平均6.5元/月起美国VPS[主机]
- 拼多多正筹建跨境电商平台:密集挖角SHEIN员工,零佣金招商入驻全球[VPS测评]
- 因搜包耽误员工下班,苹果将支付3050万美元赔款全球[VPS测评]
- SugarHosts,美国云服务器,洛杉矶cn2中美极速专线,香港建站服美国VPS[主机]
- 拼多多也要做跨境电商?出海之路能一帆风顺吗,了解一下全球[VPS测评]
- 创新互联:免备案美国香港云主机4核2G仅558元/月,5580元/年美国VPS[主机]
- 全球云lovps,香港CN2线路vps 新品七折月付49元香港VPS[主机]
- 2022年黄河流域跨境电商博览会将于8月26日至28日在青岛西海岸新区举全球[VPS测评]
- 极光kvm怎么样?香港大带宽VPS促销1核1G内存19元/月起,5G防御香港VPS[主机]
- 阿里云香港服务器多少钱一年?阿里云香港云服务器如何购买?香港VPS[主机]
- 创意加载进度HTML动画特效,SVG+CSS3实现的动画死神来了load全球[VPS测评]
转载请注明原文地址:http://140.238.13.167:12355/read-28100.html











