associate domain names with your nextcloud snap
$ nextcloud.occ config:system:set trusted_domains 1 \ --value=nextcloud.foo.bar $ nextcloud.occ config:system:set trusted_domains 2 \ --value=192.168.1.11
and then get new certs from letsencrypt
$ nextcloud.enable-https lets-encrypt
from:
https://medium.com/@dbclin/administrating-nextcloud-as-a-snap-4eb43ca6d095