I prefer SyncThing on both mobile and desktop devices. It's open source and mature, the server only makes devices findable between each other. It allows 1 or 2 way sync. And it has advanced settings for keeping removed files (e.g. trashbin that cleans anything older than X days.)
Since this is upvoted so much, I wonder what people's complete setup is for something like this to replace, say, Google Photos. So once the photos are on a "server", what do people recommend for albums, sharing, metadata, geotagging, search, etc?
With AWSPics, sync your photos (just a simple directory tree on your local device) to S3 (I just do it manually from time to time from my desktop, but no doubt it can be done automatically at regular intervals, and/or it can be done directly from a phone), then Lambda functions generate thumbnails and browsable galleries (as static HTML), then you can view it all via CloudFront (password-protected using Origin Access Identity).
AWSPics isn't really being actively maintained these days. But it still works fine for me. The setup is cheap, you basically just pay for the S3 storage (currently costing me a bit under $1/month - and I guess you could use a cheaper S3-compatible alternative like Backblaze and reduce your costs further). No server to set up or maintain. Durable backup built-in. Fast reliable CDN built-in.