Cannot get https certificate on the NextCloud installation


I’m new in this area (ubuntu, server, cloud, networking), so I might be doing some obvious mistakes.

I have installed NextCloud using Snap Package and it seems to run well on http, accessible at a forwarded external port; but for https, when executing the sudo nextcloud.enable-https lets-encrypt command, I get the following error:

Type:   connection
Detail: Fetching
   Invalid host in redirect target "". Only domain
   names are supported, not IP addresses


  • the ISP gave me a subdomain for dynamic DNS, which looks like, and for that I’ve requested the certificate;
  • I know https can be issued for such a domain ( as I’ve seen it at a friend who installed NextCloud with the Debian script;

Also, I have noticed that if I try to open the domain in the browser, I get redirected to . Only when opening the domain at the forwarded external port I can see NextCloud running.

What am I doing wrong?