Correct way to migrate Nextcloud to different location

This must be a FAQ so please point me in the right direction.

My client has a Azure/Centos/Nginx/MariaDB installation of Nextcloud which started as a trial with 30GB OS drive. I’ve added a second data disk and want to move Nextcloud to that disk. I’ve created partition, formatted and mounted it as /data.

After stopping Nginx/MariaDB services, I moved the entire web folder:

mv /usr/share/nginx/nextcloud /data

I then changed the Nginx root directive in the configuration file:

# Path to the root of your installation
root /data/nextcloud;

However, after restarting services and accessing the web portal I get this error:

Your data directory is invalid Ensure there is a file called ".ocdata" in the root of the data directory.

So I’m guessing that you can’t just change the root directive and that the path to the Nextcloud installation is also configured elsewhere?

But I then tried a different tack and used a soft link and left Nginx thinking the web site was in the same place:

ln -s /data/nextcloud nextcloud

This appears to work but I’m worried I’ve created myself a problem in the future. Any comments on this method?

did you try forum search?

I did and got many many hits so thought it better to ask.