To operate with Nextcloud and Onlyoffice without a “real / public” ssl certificate you just have to import your certificates into Nextcloud:
Logon as a priviliged user
and import your self-signed certificate into your Nextcloud:
sudo -u www-data php /var/www/nextcloud/occ security:certificates:import import /etc/ssl/certs/ssl-cert-snakeoil.pem
Restart both, the webserver and php
service nginx restart && service php7.4-fpm restart
That’s it – enjoy your Nextcloud and your (Only)Officesuite.