It seems that Syncany is everything I want - it syncs files in background, encrypts everything and has file history.
But there are a couple of major flaws:
I definitely can't rely on it for backing up my data. What a pity, I thought for a moment that I finally found what I was looking for.
I've been playing with NextCloud recently, and I suspect you'll run into some of the same road blocks I did. The biggest one is that it doesn't really have a headless daemon. There IS a cli interface, but it only does a single sync and doesn't monitor the folders for changes. Ooof. I tried installing and configuring the GUI and then rebooted and didn't login. NextCloud did not start automatically, nor could I start it without an x session. Ug.
​
The solution people have pointed to is to sync using a more generic WebDAV client like Syncany. However, they also point out that Syncany is unmaintained. Gross.
​
They aren't what you asked about, but I thought I'd mention I ran into a couple other annoyances too. The first was that NextCloud doesn't support symlinks. I also found that it took minutes to detect a change, upload it, and then have that downloaded to the other computers.
​
For me, the next step is going to be to implement an NFS share, which Nextcloud can interface with. Good luck!