Brief Intro to Domain Replacement

Be efficient

Brief Intro to Domain Replacement

I used to deploy different services/apps on different domains. And recently I decided to move those under my main site henrywithu.com, as subdomains, for the purpose of SEO.

0. Before You Start

If you are going to change your.old.domain to your.new.domain, and your.new.domain is originally hosted by Cloudflare, be sure to disable Rocket Loader, and then purge cache.
Also, for any unexpected issue, you might want to disable CDN during the process.

1. Nextcloud (Snap Installation)

sudo snap run nextcloud.occ config:system:set trusted_domains 1 --value=your.new.domain
sudo snap restart nextcloud
sudo nextcloud.enable-https lets-encrypt

2. Nextcloud (Docker Installation)

Update Nginx files and obtain new cert.
Edit config.php

nano /var/lib/docker/volumes/ubuntu_nextcloud/_data/config/config.php

Set your new domain as trusted domains

......
  'trusted_domains' =>
  array (
    0 => 'your.new.domain',
  ),
......

Run docker-compose

3. Rocket.Chat (Snap Installation)

nano /var/snap/rocketchat-server/current/Caddyfile

Replace the old domain

sudo systemctl restart snap.rocketchat-server.rocketchat-caddy

4. Discourse (Docker Installation)

nano /var/discourse/containers/app.yml

Set DISCOURSE_HOSTNAME value to your new domain

cd /var/discourse/
./launcher rebuild app

Note: Actually you can run ./discourse-setup as an easier way(according to the official document), but it didn’t work for me.
Update Nginx config files.


Copyright statement: Unless otherwise stated, all articles on this blog adopt the CC BY-NC-SA 4.0 license agreement. For non-commercial reprints and citations, please indicate the author: Henry, and original article URL. For commercial reprints, please contact the author for authorization.