Domain change nextcloud

Support intro

Sorry to hear you’re facing problems. :slightly_frowning_face:

The community help forum (help.nextcloud.com) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are volunteering their time to help you.

If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via portal.nextcloud.com where Nextcloud engineers can help ensure your business keeps running smoothly.

Getting help

In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.

Before clicking submit: Please check if your query is already addressed via the following resources:

(Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

The Basics

  • Nextcloud Server version 32.0.6
  • Operating system and version debian 13
  • Web server and version Apache/2.4.66 (Debian)
  • Reverse proxy and version nginx version: nginx/1.26.3
  • PHP version 8.4.16

I haven’t found many instructions on domain translation and nextcloud doesn’t officially support this.

Nextcloud works fine on the domain (fictional) 123.abc.com
The directory with nextcloud is stored in
/var/www/html/123.abc.com
The data directory is connected to another location
The new domain (fictional) 123.def.org exists
I can configure reverse proxy and apache

My goal
Move documentroot to a new location (or change the directory name). This shouldn’t be a problem, just a single mv command is enough.
/var/www/html/123.def.org
The database will remain untouched.

I know that it is important to edit config/config.php
I only see this to edit

'trusted_domains' =>
array (
0 => '123.abc.com',
),

'overwrite.cli.url' => 'http://123.abc.com',

Is it possible that this is how my procedure would work??

if you are using reverse proxy you must update it as well. TLS certificates and all related stuff, if you setup federated/trusted Nextcloud it requires attention as well.

In the past I changed the domain of my docker installation without frictions (but I’m the only user without any clients there :face_with_tongue: ) I would recommend to duplicate the reverse proxy config to a new domain and add new trusted domain to your config as first step, but keep old domain active in the reverse proxy and as trusted domain for some time.. later review reverse proxy logs and analyze if there are still connection to old domain, analyze one by one and once there are no more (relevant) connections you can setup http redirect or decommission the old one.

I believe the biggest problem in domain change is not technical but rather “organisational”. switching domain requires reconfiguration of all clients, if there are shares all of them become invalid etc.. Integrations with external systems like Office etc need adjustments.. at the end it’s more or less the same procedure as you have to follow when you are Migrating to a different server — Nextcloud 34 Administration Manual server_migration

I am also the only client for my nextcloud.
I have a domain on changeip.com.
A lot of free dns servers offer third-level domains for free and these are then abused for phishing.
That’s why many DNS providers block them.
I now have my own second-level domain and I want to put nextcloud there as a subdomain.
I’m not afraid to set up a reverse proxy server (that’s not a problem). Apache2 (where nextcloud runs) is also no problem. There you just need to change the documentroot and servername (+ a few directives).
However, I’m worried that something will break after these changes.
However, nextcloud and everything else runs on LXC, so before any change, a backup is enough and I can test.

I’ve already changed a few domains for wordpress this week and it was without any problems.
I think that nextcloud could also create some kind of tool for various migrations, etc.

Hi.

Honostly, it should not be that hard to do a domain change.

Start with adding the new domain as a trusted domain, and make a new Lets Encrypt certificate for the new domain, and change the lines in your webserver that points to the certificate, to point to the new one. That should about everything you need to do on the Nextcloud itself.

Start with this:

'trusted_domains' =>
array (
0 => '123.abc.com',
1 => 'NewDomain.dom',
),

'overwrite.cli.url' => 'http://NewDomain.dom',

Then issue a new certificate.

If you do not use a reverse proxy that terminates your https

Comment out the current lines in your enabled https config under sites-enabled of Apache2:

#SSLCertificateFile /etc/letsencrypt/live/123.abc.com/fullchain.pem
#SSLCertificateKeyFile /etc/letsencrypt/live/123.abc.com/privkey.pem

and add:

SSLCertificateFile /etc/letsencrypt/live/NewDomain.dom/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/NewDomain.dom/privkey.pem

Change:
<VirtualHost *:443>
ServerName 123.abc.com

to
ServerName NewDomain.dom

If you use a reverse proxy to do the https
Change the ServerName in your apache config for the sites-enabled:

ServerName 123.abc.com to ServerName NewDomain.dom

And then change the certificate used for the port 443 connection in your reverse proxy and update any domains mentioned to the new one.

It seems that according to the instructions I set at the beginning it went fine.
The only problem that occurred is that office is not working.
I have my self hosting collabora online. Nextcloud shows that the connection is fine, but the office document is not loading.
I have to look at the logs tomorrow

Edit

Office won’t load because it was blocked in the web browser. Now everything is fully functional