For flexibility there is ownCloud. Build your own, where you want, has Linux and all the stuff you need.
Their IRC channel is no help in debugging. Disabling all apps doesn't help, looking at the php & syslog don't show any errors, and adding caching only saves a few seconds of rendering time.
Nextcloud has seriously lowered my standards for bad PHP projects, making most others look well written and decently documented/debuggable.