Custom SSL Certificate for different domains

Hi, I have installedNextCloud in Ubuntu using a snap version. I have configured an SSL certificate for my intranet domain. I want to use another custom SSL certificate for my public domain. to enable HTTPS with a custom SSL certificate I use the sudo nextcloud.enable-https custom -s <cert.pem> <privkey.pem> <chain.pem> command.

My question is how can I add the second certificate for the public domain? if I use the same command for the second domain will it replace the first one? or it will be used in addition to the first domain?

Thats a good question. First that comes to mind is: why a custom cert and not LetsEncrypt for the public domain?

You can solve this in three ways. The first way (as you use the SNAP, it is way harder to customization the webserver to listen on more than one domain name for the same vhost config) is to add a hostname so you got two hostnames in your vhost for Nextcloud, and then in the LetsEncrypt, adds two domains to the hook.

Second method: Go through a reverse proxy and let the reverse proxy do the TLS for one domain and SSL passthrough for the other and keep the default setting for the SNAP.

Third method:
Disable HTPPS on the snap, but setup a reverse proxy on the same machine and terminate TLS on the reverse proxy for both domains.