How to set the apache configuration file to have nextcloud office to work

Protect for/against what?

Did you read other posts about encryption like

Did you read and understand the Admin manual about encryption and its purpose:

The primary purpose of the Nextcloud server-side encryption is to protect users’ files on remote storage, such as Dropbox and Google Drive, and to do it easily and seamlessly from within Nextcloud.

I guess that your idea of security is based more on gut feeling than on a carefully planned strategy. Otherwise you would have read the manuals that describe incompatibility with the individual apps etc.

Much luck,
ernolf