Tutorial on using Syncthing to build your own private sync disk

888u

Last update at :2024-02-09,Edit by888u

Introduction

syncthing should be the most popular synchronization disk program in the open source industry at present. This program is mainly private, and it is truly completely private. . . There is no public sharing function, and synchronization requires both ends to add each other's permission.

After all, it is developed based on GO. It is very simple to set up, and the official binary file is provided, which is ready to use after downloading:

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

Here I still configure the program as a systemd service according to my own habits:

vi /etc/systemd/system/syncthing.service

Write:

[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

Then run:

systemctl start syncthing

Set up startup:

systemctl enable syncthing

Because syncthing only listens locally by default, we need to use Nginx as a reverse proxy. However, the new version of syncthing has added a host header detection function. This must be turned off, otherwise Nginx cannot perform reverse proxy:

vi ~/.config/syncthing/config.xml

Add below the GUI settings:

true

As shown in the picture: Then restart:

systemctl restart syncthing

Install Nginx:

yum -y install nginx

Create a new Nginx site configuration file:

vi /etc/nginx/conf.d/syncthing.conf

Write:

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; } }

Here I have syncthing monitored on port 5862, which is not a regular port, because there is no password verification when the WEBUI is first started. To prevent abuse, it is recommended to monitor a high-level port. Later, we log in, set the password, and then change it back to 80. It is all acceptable.

Now start Nginx and set up startup

systemctl start nginx systemctl enable nginx

Now open your site domain name:

http://example.com:5862/syncthing

You should be able to access the homepage of this sync disk: Now you should immediately set a password for this WEBUI: For Windows clients, I personally recommend this: https://github.com/canton7/SyncTrayzor

Download: https://github.com/canton7/SyncTrayzor/releases/download/v1.1.22/SyncTrayzorSetup-x64.exe

I tested the function and it can be synchronized normally:

Recommended site searches: mysql virtual host, Beijing server rental, server rental, overseas server rental price, US anti-attack server, Guangdong server rental, php virtual space, host discount code, server rental, purchase domain name and space, < /p>

Tutorial on using Syncthing to build your own private sync disk

All copyrights belong to 888u unless special state
取消
微信二维码
微信二维码
支付宝二维码