This will allow you to backup, sync and update local files that you want to be instantly available on a website or server. I will be using this to backup and sync this tiddlywiki coding journal from a local pc folder to a Nextcloud server data folder while also using a link from the Nextcloud data folder to an html folder which will allow me to view the updated code from a website url.
1. Create a sync from pc to Nextcloud data folder
For this tutorial, my Nextcloud data directory will be in the ‘/var/www/data' folder, just below the html folder which holds the Nextcloud site.
1. On you pc, If you haven't already done so, create a folder that will hold the files you wish to sync to the Nextcloud data folder
2. If you don't already have a folder that you want sync'd in Nextcloud, create it.
3. Open the Nextcloud app on your pc
4. On your pc, Follow the prompts to ‘Add Folder Sync Connection' by browsing to the folder and syncing to your Nextcloud folder In this case, ‘/var/www/data/user/files/syncfolder' where ‘user' is your Nextcloud username and ‘syncfolder' is the folder to sync.
Now your files on your pc should be sync'd to your Nextcloud folder.
2. Create a symbolic link to the html root
Next we will create a link from a file in the Nextcloud data folder to a location in our html folder on the same server.
$ sudo ln -s /var/www/data/user/files/syncfolder/thefile.html /var/www/html/
You can choose any accessible location inside your html root. In this case, the url will be ‘https://mydomain.com/thefile.html‘
Now, whenever you update the file locally on your pc, Nextcloud will automatically sync this file to the data directory which will then be accessible via an url. Of course, the file(s) will also be available inside your user ‘Files' directory in Nextcloud.