Nextcloud snap installation not accessible via LAN

I installed the Nextcloud snap package on Ubuntu 20.04 LTS.

I did by running:

sudo snap install nextcloud

Then adding a user and password:

sudo nextcloud.manual-install user password

I added my own custom subdomain by running:

sudo nextcloud.occ config:system:set trusted_domains 1

Then I obtain an ssl certificate using Letsencrypt:

sudo ufw allow 80,443/tcp

sudo nextcloud.enable-https lets-encrypt

I can now access it via subdomain, but I would like to access it via local network, via the server’s local IP address and port.

I tried making it listen to 5050 port by running:

sudo snap set nextcloud ports.http=5050

However, if I try accessing the browser shows NET::ERR_CERT_COMMON_NAME_INVALID

I also tried adding to the trusted domains.

How can I make the Nextcloud server accessible from

Let’s Encrypt works by confirming that the domain name in the certificate is the one you’re trying to activate. That only makes sense if that certificate is then used for that domain name. By using the IP address instead of the domain name in the certificate, your browser is throwing up a flag saying “Hey, this cert is not valid for what you’re trying to access.”

You’re not going to be able to do this and use Let’s Encrypt without seeing that warning. You can use self-signed certificates if you want, but then you’ll just see that warning all the time. I suggest just using your domain name from within your network, assuming your networking gear allows it.