Nextcloud: move service to a new domain



  1. Get the new domain name to replace the old one (e.g. move from yyy.com to zzz.com).

  2. Setup DNA records on the domain provider. Point the hostname to the IP address of virtual server. (e.g. figure below shows the setting for Digital Ocean)

    WESTERLIES

  3. ssh to the virtual server. Setup the new domain, disable HTTPS, remove certs files.

    sudo nextcloud.occ config:system:set trusted_domains 1 --value=zzz.com
    sudo nextcloud.disable-https
    sudo rm -rf /var/snap/nextcloud/current/certs
    
  4. Install certbot and update certs files.

    sudo snap install certbot
    cd /var/snap/nextcloud/current
    sudo mkdir certs
    sudo cp -a /snap/certbot/current/. /var/snap/nextcloud/current/certs/certbot/
    
  5. Update Let's Encrypt for the new domain.

    sudo snap remove certbot
    sudo ufw allow 80,443/tcp
    sudo nextcloud.enable-https lets-encrypt
    
  6. Wait until the new domain presents a Nextcloud login page.

    WESTERLIES