Skip to main content

Migrate Nextcloud To Another Server

Your

Setting Nextcouldup instancethe needsNew Server

  1. Install the Operating System: Set up the new machine with the desired operating system.
  2. 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.
  3. Set up the Database: Set up the database and ensure it's a Nextcloud-supported configuration.
  4. Copy Configuration (Optional): If your original machine was installed recently, you can safely copy the base configuration from the old server to bethe shutnew downserver completely. Including anything that runs along side it. 

    Start by creatingas a newbest practice.

Migrating Data from the Old Server

  1. 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/config

    After waitingWait for 6-7 minutes forto allow all sync clients to register that the server is in maintenance modemode.

  2. Stop Nextcloud: After the waiting period, stop the application and/or Webweb server that serves Nextcloud (if applicable). Nextcloud.

  3. 2)Create a Database Backup: Create a dump  fromof the database on the old server and copy it to the new machinemachine. 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

  4. 3)Copy Nextcloud Files: Copy all files from your Nextcloud instance,instance on the old server, including the Nextcloud program files, the data files, the log filesfiles, and the configuration files, to the new machinemachine. Ensure that the data files retain their original timestamps (you can use rsync 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 the config.php file accordingly. (See "Backup and Restoring backup" for more details.)

  5. 4)Check Data Fingerprint: Check the config.php file of the ORIGINALold system to see if it has the data-fingerprint set to a non-empty value.

    If this is the case, make sure to alsoso, run the maintenance:data-fingerprint command on the NEWnew system, similarlysimilar to how it isit's required when performing a backup restoratiorestoration. (See "Restoring backup" for details.)

Testing and Finalizing the Migration

  1. 5)Test the New Server: While Nextcloud is still having Nextcloud in maintenance mode (confirm!) and BEFORE changing the CNAME record in the DNS start up the database, Web server / application server on the new machineserver (confirm!), start the database, web server, and pointapplication yourserver. web browser toAccess the migrated Nextcloud instance.instance

    in

    6)your web Changebrowser. Confirm that you see the maintenance 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.

  2. 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
  3. think I can skip this because i use a proxy service and it just looks for whatever port i tell it to)

Full article from Nextcloud:  
https://docs.nextcloud.com/server/stable/admin_manual/maintenance/migrating.html