Migrate Nextcloud To Another Server
Your
Setting Nextcouldup instancethe needsNew Server
- Install the Operating System: Set up the new machine with the desired operating system.
- Configure Web Server and PHP: Install and configure the web server (e.g., Apache or Nginx) and PHP for Nextcloud. Ensure that the PHP version matches Nextcloud's supported configuration, and all relevant PHP extensions are installed. Also, set the appropriate permissions and file upload size limits.
- Set up the Database: Set up the database and ensure it's a Nextcloud-supported configuration.
- Copy Configuration (Optional): If your original machine was installed recently, you can safely copy the base configuration from the old server to
betheshutnewdownservercompletely. Including anything that runs along side it.Start by creatingas anewbest practice.
Migrating Data from the Old Server
-
Enable Maintenance Mode: On the old server, stop Nextcloud
instance on your new machine.1) On old machine,and activate the maintenance mode.This should be done through the config.php file. /path/to/nextcloud/configAfter waitingWait for 6-7 minutesforto allow all sync clients to register that the server is in maintenancemodemode. -
Stop Nextcloud: After the waiting period, stop the application and/or
Webweb server that servesNextcloud (if applicable).Nextcloud. -
2)Create a Database Backup: Create a dumpfromof the database on the old server and copy it to the newmachinemachine. Then, import the dump into the database on the new server. (See "Backup and Restoring backup" for more details.)https://docs.nextcloud.com/server/latest/admin_manual/maintenance/backup.html -
3)Copy Nextcloud Files: Copy all files from your Nextcloudinstance,instance on the old server, including the Nextcloud program files,thedata files,thelogfilesfiles, andtheconfiguration files, to the newmachinemachine. Ensure that the data files retain their original timestamps (you can usersync
with the-t
option) to prevent clients from re-downloading all files after the migration. Note that the file locations may vary depending on the original installation method and operating system. On the new system, make sure to place the files in the appropriate locations. If you change any paths, adapt the paths in theconfig.php
file accordingly. (See "Backup and Restoring backup" for more details.) -
4)Check Data Fingerprint: Check theconfig.php
file of theORIGINALold system to see if it has thedata-fingerprint
set to a non-empty value.If
this is the case, make sure to alsoso, run themaintenance:data-fingerprint
command on theNEWnew system,similarlysimilar to howit isit's required when performing a backuprestoratiorestoration. (See "Restoring backup" for details.)
Testing and Finalizing the Migration
-
in5)Test the New Server: While Nextcloud is stillhaving Nextcloudin maintenance mode(confirm!) andBEFOREchanging theCNAMErecord in the DNS start up the database, Web server / application serveron the newmachineserver (confirm!), start the database, web server, andpointapplicationyourserver.web browser toAccess the migrated Nextcloudinstance.instance6)your webChangebrowser. Confirm that you see themaintenance mode notice, log entries are written by both the web server and Nextcloud, and no error messages occur. Then, take Nextcloud out of maintenance mode and repeat the testing. Log in as an admin and confirm that Nextcloud is functioning normally.
-
Update DNS: Once you've confirmed that the new server is working correctly, change the CNAME entry in the DNS to point your users to the new server's location.
(I
Full article from Nextcloud:
https://docs.nextcloud.com/server/stable/admin_manual/maintenance/migrating.html