简介
syncthing应该是目前开源界人气最高的一款同步盘程序了,这个主打私有,真的完全私有。。。没有公开分享的功能,并且同步必须要两端相互添加对方许可才行。
毕竟是基于GO开发的,搭建都很简单,并且官方提供了二进制文件,下载即用:
1
2
3
4
|
wget https://github.com/syncthing/syncthing/releases/download/v1.0.0/syncthing-linux-amd64-v1.0.0.tar.gz
tar -xzvf syncthing-linux-amd64-v1.0.0.tar.gz
cd syncthing-linux-amd64-v1.0.0
cp syncthing /usr/bin
|
这里我还是按照自己的习惯把程序配置成systemd的服务:
1
|
vi /etc/systemd/system/syncthing.service
|
写入:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
[Unit]
Description=Syncthing – Open Source Continuous File Synchronization
After=network.target
[Service]
User=root
ExecStart=/usr/bin/syncthing -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
ProtectSystem=full
PrivateTmp=true
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true
[Install]
WantedBy=default.target
|
然后运行:
1
|
systemctl start syncthing
|
设置开机启动:
1
|
systemctl enable syncthing
|
因为syncthing默认只监听本地,所以我们要用Nginx做一下反向代理,但是syncthing新版本加入了一个主机头检测的功能,这个要关闭,不然Nginx无法进行反代:
1
|
vi ~/.config/syncthing/config.xml
|
在GUI设置的下面加入:
true
如图所示:
然后重启:
1
|
systemctl restart syncthing
|
安装Nginx:
1
|
yum -y install nginx
|
新建一个Nginx站点配置文件:
1
|
vi /etc/nginx/conf.d/syncthing.conf
|
写入:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
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以及设置开机启动
1
2
|
systemctl start nginx
systemctl 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
测试了一下功能,可以正常同步:
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《使用Syncthing自建私有同步盘教程》
文章链接:https://www.liuzhanwu.com/2028.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
文章名称:《使用Syncthing自建私有同步盘教程》
文章链接:https://www.liuzhanwu.com/2028.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。
相关推荐
456CDN:为网络安全与加速保驾护航,CDN测评推荐
456CDN:高防CDN,200GB DDoS防护,无视CC,1TB流量@50Mbps带宽,500元/月,安全加速,智能守护,稳定安全
#618大促#最后一天|凌霞软件旗下新一代服务器面板 1Panel:永久授权 539元起,10台4900元,即买即赠SSL证书
#618大促#最后一天|凌霞软件旗下强大易用的建站工具 Halo:永久授权 660元起,10台6000元,即买即赠SSL证书
#6.18促销#Themebetter:WordPress主题特惠7折,DUX主题折后559元,不限制域名授权数目
耗子Linux 面板:又一个轻量 Linux 服务器运维管理面板
#11.11#Themebetter:年度大放价,全场6折特惠,DUX主题折后480元,不限制域名授权数目
紧急提醒:DediPath官宣跑路