使用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
- 特网云:高防香港云主机/CN2/真实防御/30G高防御/金盾防护无视CC 香港VPS[主机]
- 八成企业看好出海投资 防止“溺水”需重视这一点 全球[VPS测评]
- 什么是IconFont ?iconfont 的使用和解析 全球[VPS测评]
- 潮科技|阿里云发布第七代高主频云服务器ECS和含光800云服务器 全球[VPS测评]
- 拼多多也要做跨境电商?出海之路能一帆风顺吗,了解一下 全球[VPS测评]
- 宝塔面板怎么放行端口?宝塔面板放行端口的方法 全球[VPS测评]
- sugarhosts首推DECADE云服务器,香港云服务器,1核512M 香港VPS[主机]
- CombCloud,香港沙田CN2VPS测评,2核1G52元/月,安畅C 香港VPS[主机]
- 众创逸云:1核2G云服务器,不限流量vps/5Mbps/KVM/香港CN 香港VPS[主机]
- 天生云:香港CN2VPS/2核/4G/100G硬盘/4Mbps不限流量, 香港VPS[主机]
- 无忧云:香港大埔/荃湾云服务器5折优惠,可叠加优惠码,国内高防78元起 香港VPS[主机]
- 咖啡主机:新上香港云服务器、美国CN2轻量级KVM vps,香港15.6 美国VPS[主机]
- 极光KVM:香港CN2大带宽vps6折优惠,美国CN2 GIA套餐年付低 美国VPS[主机]
- 阿里云香港服务器多少钱一年?香港云服务器租用年付价格表 香港VPS[主机]
- UCloud:全球31个机房全球云服务器大促,香港2核4G低至485元/ 日本VPS[主机]
- 一个纯CSS ToolTip提示工具组件,鼠标悬停的时候会出现气泡文字提 全球[VPS测评]
- 华纳云新春活动:香港CN2云服务器4核4G5M仅3476元/3年;美国云 美国VPS[主机]
- 天生云:香港沙田CN2 GIA VPS,1核1G40G/2M带宽,月付8 香港VPS[主机]
- 老六云:⾹港⼤宽带服务器、香港大带宽vps_新购⾸⽉85折优惠 香港VPS[主机]
- 特网云:香港高防CN2云服务器,新加坡/美国/洛杉矶/英国/荷兰等,5M 美国VPS[主机]
- Pia云:美国洛杉矶vps,三网回程GIA,月付15元起;10M大带宽香 美国VPS[主机]
- 柚子互联:香港CN2云服务器/天机盾防护/带宽5M,34元/月 香港VPS[主机]
- 易探云:香港BGP/CN2高防云服务器租用价格表 香港VPS[主机]
- V5.NET:香港/美国云服务器7折月付42港元起;香港物理服务器月付3 美国VPS[主机]
- LiCloud:香港CN2线路云服务器,100Mbps大带宽,6折优惠中 香港VPS[主机]
- 买了一台云服务器到底能干什么? 全球[VPS测评]
- 极客主机,优惠8折充值返25%,香港CN2VPS,日本软银VPS,新加坡 日本VPS[主机]
- 无忧云怎么样?大连BGP德阳100G高防香港CN2VPS云服务器 香港VPS[主机]
- 企鹅小屋怎么样?深港IPLC专线销售 500M大带宽/2核1G内存/55 全球[VPS测评]
- 磐逸云怎么样?1核1G香港安畅CN2 VPS带宽5M年付128元 香港VPS[主机]
转载请注明原文地址: http://140.238.13.167:12355/read-31339.html











