Installing and Setting Up Certbot
Installing snapd to allow you to install the certbot snap package (if you have not previously installed snapd).
sudo apt install snapd
Install and refresh Core.
sudo snap install core; sudo snap refresh core
Install certbot.
sudo snap install --classic certbot
Create certbot symlink.
sudo ln -s /snap/bin/certbot /usr/bin/certbot
Run certbot and follow on screen instructions.
sudo certbot --apache
Open Nextcloud’s configuration file.
sudo nano /var/www/nextcloud/config/config.php
Change ‘trusted_domains’ value to preferred domain.
0 => 'example.domain',