Changing Domain name for your Nextcloud server

How to change the domain name for your Nextcloud server.

117 views
d

By. Jacob

Edited: 2023-09-10 22:46

Changing the domain name of a Nextcloud server is fairly straight forward, but it is not officially supported. That's okay, because you are an expert, and so you do it anyway.

1. Put your Nextcloud in maintenance mode

2. Stop the Apache server while making changes

3. Change the V-host settings. E.g. ServerName in your Apache configuration.

4. Change the trusted domain in your Nextcloud config/config.php file:

$CONFIG = array (
  // ...
  'trusted_domains' => 
  array (
    0 => 'next.example.com',
  ),
  // ...
)

5. Create a DNS A record for your new domain name that points to the IP address of your Nextcloud server.

6. (Recommended) redirect requests from the old domain to the new. E.g:

RewriteEngine on
RewriteRule (.*) http://newdomain.example.com/$1 [R=301,L,QSA]

QSA will append the query string (if any) to the destination.

$1 is a backreference containing the requested path. E.g. Makes the client request the same path on the new domain.

7. (Optionally) remove the A record for your old domain name if no longer needed.

Changing the domain not officially supported

Changing the domain after the first setup is currently not supported by Nextcloud. That is mainly because Nextcloud’s apps don’t support changing the domain after they are set up.

Source: https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/domain_change.html

According to the official documentation, changing the domain name may not be possible because some apps might not support it. Well, maybe those apps are just poorly made. Imo. Web applications should function independent from the domain, and if not, there should be a way to change the domain easily. E.g. Database entries and so on.

Many Nextcloud users might be first-time users, hobbyists experimenting, and so on. It is in our interest to make a possibly future domain-move an easy and smooth experience. Some, like myself, may have installed their first Nextcloud on a temporary or inconvenient domain, but people might hesitate moving because they fear having to start over from scratch.

Links

  1. Domain Change - docs.nextcloud.com

Tell us what you think:

  1. You need to route ocm-provider requests to index.php to have the error go away. The error started showing after I upgraded my Nextcloud server some time ago, and I have not had time to fix it until now.
  2. The Nextcloud notes app is worth using, because it stores notes in a logical and natural way, secures your notes and ensures you will never lose access to them.
  3. This can happen when the Redis environment is configured incorrectly, and/or when the redis-server.sock file has the wrong permissions.
  4. How to toggle maintenance mode on or off for your Nextcloud server
  5. Prevent your Nextcloud data directory from being accessible from the internet.

More in: Nextcloud