It's not quite free/libre, but I was positively surprised by Synology Moments.
It's basically a software package on the Synology NAS which creates a locally hosted version of Google Photos (including sharing and gallery capability). It comes with Android/iOS apps that can automatically backups all photos directly to your NAS and thus stay in your own ownership.
There is a cost of entrance though - you need to buy the NAS and harddrives... but IMO there's nothing quite like owning your own data.