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/binHere I still configure the program as a systemd service according to my own habits:
vi /etc/systemd/system/syncthing.serviceWrite:
[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.targetThen run:
systemctl start syncthingSet up startup:
systemctl enable syncthingBecause 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.xmlAdd below the GUI settings:
true
As shown in the picture: Then restart:
systemctl restart syncthingInstall Nginx:
yum -y install nginxCreate a new Nginx site configuration file:
vi /etc/nginx/conf.d/syncthing.confWrite:
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 nginxNow 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>
发表评论