使用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
- 分享 Virmach 优惠码使用及 VPS 购买图文教程全球[VPS测评]
- 特价 Hostodo→ 1 核 512MB 内存 8GB NVMe 硬盘全球[VPS测评]
- $3.5 月 1G 内存 50G 硬盘 1T 流量 1Gbps KVM 全球[VPS测评]
- 优惠 死海网络元旦促销→VPS 业务 75 折起 洛杉矶双向 CN2 线全球[VPS测评]
- UOvZ 国内移动 100G 高防服务器促销 江苏地区 双路 E5-26全球[VPS测评]
- AkkoCloud→129 元 月 1GB 内存 50GB SSD 空间虚拟空间(主机)
- 抢购 HostDare→亚洲优化线路 65 折优惠 1 核 756M 内全球[VPS测评]
- [11.11]KVMLA 香港 日本 新加坡年付 6 折 月付 8 折日本VPS[主机]
- 没有用过-MoeVM→139 元 月 上海 CN2 服务器 500G 流全球[VPS测评]
- TNAHosting→芝加哥独立服务器月付 19 美元起 6G 内存 4独立服务器[U]
- ¥21.25 月 512M 内存 10G SSD 500G 流量 20M全球[VPS测评]
- 便宜 VPS $10.5 首年 512M 内存 10G SSD 500G全球[VPS测评]
- 如何处理 WordPress 网站 404 报错页面?全球[VPS测评]
- WordPress基于WPJAM BASIC开发的免费主题:Autumn全球[VPS测评]
- 代码实现类似大前端DUX WordPress主题评论列表显示楼层全球[VPS测评]
- DomaiNesia 5$ 印尼雅加达VPS 测试(踩坑)全球[VPS测评]
- 很简单的图片不规则布局样式,纯css样式实现的图片瀑布流布局全球[VPS测评]
- 很简单的图片不规则布局样式,纯css样式实现的图片瀑布流布局全球[VPS测评]
- 实例 GIA0910629396 重启失败,原因:sudo: unabl全球[VPS测评]
- 月神云:洛杉矶CN2 GIA高防vps、香港CN2 GIA VPS全场7香港VPS[主机]
- 极光kvm怎么样,便宜大带宽香港cmi vps/美国gia vps低至1美国VPS[主机]
- 向日葵-漏洞科普:海外云服务器三种漏洞修复方法快收藏起来!全球[VPS测评]
- 初忆云:湖北电信云服务器1核2G仅6.8/月,81.6元/年;香港cn2香港VPS[主机]
- wikihost,微基主机服务,100M带宽香港CMIVPS,5G防御,香港VPS[主机]
- 亿速云“双11”上云狂欢大促 高防云服务器、裸金属服务器优惠套餐全球[VPS测评]
- 谷歌浏览器网址如何显示http,www,Chrome谷歌浏览器恢复地址栏全球[VPS测评]
- 六六云:香港BGP云服务器/80M大带宽,月付45元起,5折优惠码可用香港VPS[主机]
- edgeNAT:2021元旦vps促销_全场韩国/美国/香港VPS低至7韩国VPS[主机]
- DiyVM:香港服务器499元起,香港/美国vps五折/2G内存,月付6美国VPS[主机]
- 众创逸云:清明促销,香港沙田/安畅vps前两月半价;美国CERA首月半价美国VPS[主机]
转载请注明原文地址:http://140.238.13.167:12355/read-24855.html











