使用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
- 易探云:香港免备案云服务器年付6.8折,2核4G5M+10G数据盘仅79 香港VPS[主机]
- 为什么要拥有一台VPS? 全球[VPS测评]
- 菜单选中标记CSS3动画效果 全球[VPS测评]
- 牛信云入选艾瑞《2022年中国跨境电商服务行业趋势报告》典型厂商 全球[VPS测评]
- 外贸无界烟台市有多少跨境电商?烟台跨境电商开发平台,烟台跨境电商选品 全球[VPS测评]
- Vultr新用户100美金 最新活动来啦!新用户充值活动来了,充100美 全球[VPS测评]
- 磐逸云怎么样?CN2线路香港VPS月付20元 香港VPS[主机]
- 香港vps免费:青云互联,1核1G/50G硬盘/500GB流量/2M带宽 香港VPS[主机]
- edgenat:韩国cn2+香港cn2,VPS八折优惠,8核8G/50g WINDOWS
- 初忆云:香港美国cn2云服务器30元;香港cn2高防vps30元,美国1 美国VPS[主机]
- 咖啡主机:元旦活动全场7、8折,洛杉矶vps仅需16元/月,香港将军澳C 香港VPS[主机]
- tmhhost官网登录不上怎么办?日本软银/美国CN2 GIA/美国高防 日本VPS[主机]
- UCloud海外节点vps活动:香港、台湾等全球14个机房1折起,最低仅 香港VPS[主机]
- 三优云uuuvps:春节促销,香港cn2 vps低至168元/年,多款配 香港VPS[主机]
- 悠久云:香港云服务器低至9.9元/月;香港大带宽vps,4核4G30M仅 香港VPS[主机]
- 麻花云:香港CN2云服务器首月9元起;安徽移动BGP云主机月付29元起 香港VPS[主机]
- UCloud:香港云服务器,1核1G内存89元/年起(可选购3年/CN2 香港VPS[主机]
- MineServer:香港CMI云服务器,1核/512MB/10GB空间 虚拟空间(主机)
- 41云:香港CN2云服务器,1核/1G/10M带宽,月付28元 香港VPS[主机]
- 快快数据测评:香港CN2云服务器,2核/1G/5M带宽,低至24元/月 香港VPS[主机]
- V5.NET:香港/美国云服务器7折月付42港元起;香港物理服务器月付3 美国VPS[主机]
- jquery css3实现的进度条动画特效,带加载进度条百分比动态效果。 全球[VPS测评]
- 阿里云服务器一年价格多少钱?阿里云服务器报价 全球[VPS测评]
- 74块钱一年的云服务器可以用来做什么? 全球[VPS测评]
- 晚点独家丨拼多多9月上线跨境电商平台,首站美国 美国VPS[主机]
- 跨境贸易和跨境电商的三大区别简单分析 全球[VPS测评]
- 向日葵-漏洞科普:海外云服务器三种漏洞修复方法快收藏起来! 全球[VPS测评]
- JGKVM促销,美国cn2vps服务器价格再创新低,平均6.5元/月起 美国VPS[主机]
- 磐逸云怎么样?香港沙田cn2vps 带宽5M年付128元 香港VPS[主机]
- kvmla,新加坡VPS、香港VPS、日本VPS,2核2G云主机仅425 日本VPS[主机]
转载请注明原文地址: http://140.238.13.167:12355/read-21606.html











