How to access Nextcloud Server using a different Domain

Hi guys - my server details are shown below:-

Nextcloud version (eg, 20.0.5): Nextcloud Hub II (23.0.0)
Operating system and version (eg, Ubuntu 20.04): 20.04.3 LTS
Apache or nginx version (eg, Apache 2.4.25): 2.4.41
PHP version: ‘7.4.3’

I have my server set up so I can access it using the Domain: example.com/nextcloud

I now own a new domain example.com - how can I access my Nextcloud server using my new domain as well as keeping my old domain.

Easy instructions please as I’m still a newbie with all of this.

Thanks in advance

example.com/nextcloud would be a sub-domain.
You define this on your hosting service.

You will be adding example.com/nextcloud as a trusted domain in Nextcloud’s config.

Log into (or Secure Shell into) your server hosting Nextcloud. Open the necessary configuration file with the command:

sudo nano /var/www/html/nextcloud/config/config.php

In that file, you should see the line:

0 => IP_1

Where IP_1 is the original IP address of your Nextcloud server.

Add a new line below, like so:

1 => IP_2

Where IP_2 is the new IP address of the Nextcloud server.

The end result should have both old and new IP addresses listed (Figure A).

Ready to log in

After you save and close the config.php file, you should now be able to go back to your Nextcloud instance without the Trusted Domain issue preventing logins. There's no need to restart Nextcloud or the hosting server. That's all there is to resolving this particular issue. Just remember, if you change the IP address of your server again, you'll need to add the new address to the config.php file.

You can search for more guides on Trusted Domains, or just read the admin documentation:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/