First, add setup checks for most required modules and also detect incompatible modules.
- mod_deflate: https://github.com/owncloud/core/issues/4783
- detect whether important PHP functions are blocked
- detect if all required Webdav verbs are available: https://github.com/owncloud/core/issues/16625
- check that headers are properly going through like X-OC-MTime, Destination, Authorization, and others required for syncing and Webdav
- detect pagespeed on nginx: https://github.com/owncloud/core/issues/14604
- pagespeed on apache: https://github.com/owncloud/documentation/issues/3912
- LimitRequestBody: https://github.com/owncloud/core/issues/13065#issuecomment-72360180
- openssl warning for encryption: https://github.com/owncloud/core/issues/21319
- more to find in the core repository....
Additionally, add a hardening checklist with automated checks that tell whether this is done or not: https://github.com/owncloud/core/issues/26059