Migrating your websites to the DV server


Browse by products and services

  • Applies to: All DV
    • Difficulty: Medium
    • Time Needed: 60
    • Tools Required: SSH, FTP client, DNS Control

Overview

Whether you have a site with just static html pages or a dynamic database-driven one, this migration guide will help you get started with your new DV server. This document is by no means comprehensive but it should cover the basics to get you on your way.

TIP:

If your old host also uses Plesk, or Ensim/cPanel/Hsphere and some others, you can automate practically all of the steps covered in this article by following this article instead. It is recommended to use the built-in Plesk Migration Manager whenever possible.

Getting started

Moving your site to (mt) Media Temple involves a few simple but important steps:

READ ME FIRST

The publishing of this information does not imply support of this article. This article is provided solely as a courtesy to our customers. Please take a moment to review the Statement of Support.

  1. Lower the TTL for the domain(s) you will be migrating.
  2. Set up the new server.
  3. Back up all website content, databases, and emails from your current host.
  4. Upload files and import your databases to your new hosting service at (mt) and re-create any email accounts.
  5. Update database connection strings and system paths to match the environment.
  6. Test the site using your IP address.
  7. Change DNS settings.
  8. Double-check migration accuracy, cancel old service.

Below, we will go into more detail. This guide assumes you still have access to your old host. We will use and refer to elements of WordPress as the example for moving a site with dynamic content. Throughout this guide there will be basic instructions and some more advanced.

move_to_mt_560x240

CloudTech Can Help!
(mt) Media Temple offers assisted site migrations via CloudTech, our premium services division. To learn more, please click here.


Instructions

Order the server

If you haven't already, order your new DV server from the AccountCenter. See Managing/Ordering servers for details.

A couple things to keep in mind:

  • The new server cannot have the same domain as an existing service at the time it is ordered; although this can be changed later, if desired.
  • Don't use a subdomain of a domain that is currently on another service. You could use something like new-example.com, or just a random string of characters like igw8aclrj2.net.

Lower your TTL

Please lower your TTL so that your DNS change to the new server goes smoothly. Click the link for instructions.

Set up the new server

Please follow the instructions in Plesk first-time setup to configure the basic settings for your new server.

You need to set up your site in Plesk in order to complete this manual migration process. See Adding domain in Plesk for steps.

Backup

Website Content

Log into your old host and download all the files for your domain to your local computer. The most popular way to do this is via FTP. This guide assumes that you have a familiarity with using FTP. For more information, please read: FTP information.

Alternatively, you can also use the SSH command SCP to transfer files from your old host directly to your DV. Using SSH on your old host, run this command from the document root (this folder might be called httpdocs, html, public_html, or other variants). Please note that the document root for your DV server will always be called httpdocs and nested under a domain folder.


scp -r * username@example.com:httpdocs/

This should transfer all of the files directly to your DV from the old host.

Databases

If you are moving over a site that has a database, we will need to make sure we move that database over also. There are a variety of ways to do this. We will focus on some simple examples using phpMyAdmin and using the shell. See Export and import MySQL databases for more info.

Point-and-click backup using phpMyAdmin
  1. Log into your old host's phpMyAdmin panel and click on your database on the left hand side.
  2. Now that your database is selected click on the "Export" tab at the top.
  3. Please make sure you have selected the appropriate options in the screenshot below.

    phpmyadmin

  4. Save the file, making sure to select "zipped" under "Compression". This will greatly reduce the size of your database file.
Via SSH

Again, an alternative method is possible via SSH. A MySQL dump can be performed. Using SSH, log into your old host. Using the mysqldump command we will create a backup of your database and then transfer it using SCP to your DV server. Please consult your old host if you do not know your login details. Replace DATE with today's date if you like.

  1. First we create the dump:
    
    mysqldump –-add-drop-table -uusername -p [password] databasename > mysqlbackup.DATE.sql
    
  2. Then we transfer it over
    
    scp mysqlbackup.DATE.sql username@example.com:private/
    

Upload & Re-create

Now that you have a complete backup of your site files and database we need to move them to your DV server.

Website Content

  1. Make sure you have created the new site using Adding domain in Plesk. Once this is complete, we will have a place to put the content.
  2. If you did not use SCP to move your files over in the advanced step above please upload your files using FTP to this new domain. Your web path should be httpdocs.Place all your content here.
  3. At this point, you should be able to see your content using How do I set the default site for an IP address? This makes it easy to "preview" your site before switching over your DNS which we will get to shortly.

Databases

First, we need to create a new database. For the purposes of this guide, you should be using MySQL. After you've created your database, proceed with the next steps.

Importing via phpMyAdmin

These steps are for databases that are under 10MB only.

  1. Click Domains >example.com > Databases > Database Name > DB Webadmin to reach phpMyAdmin for your domain.
  2. From the column on the left, select the database that you want to restore to.
  3. Click on Import from the top set of tabs and click on Browse to upload your file. Make sure you have unzipped your file locally first. You want to import a *.sql file, not a *.zip file.
  4. If successful, you should receive a message similar to this:
    "Your SQL-query has been executed successfully: The content of your file has been inserted."
Importing via command-line
  1. Log into your DV server using SSH. Then navigate to your data directory. This is where we transferred our backup to earlier.
  2. First, we establish the connection:
    
    ssh username@example.com
    
  3. Then we change directories:
    
    cd private
    
  4. Now, we will import your older data into your new database:
    
    mysql -u dbuser -p dbname < mysqlbackup.DATE.sql
    

Re-Create your email accounts

This is fairly simple to do and requires only logging in to the Plesk Control Panel and going to the Mail section. Please see this article for details.

Site Paths and Previews

Many times, you will not need to worry about updating site path references in your website code. There are some cases, however, where this can occur and make your website appear to be broken. The reason for this is every host has a different design and preference on their directory structure. Most modern applications and coding practices encourage using relative paths and variables, so this should not be a big concern.

One important thing to mention is that WordPress and many other apps do have a configuration setting for the domain name. If you try to preview your website (we'll cover how a bit further down) using your IP Address you may experience display problems. For this case and cases like it, you'd need to change a setting which makes your IP the site URL.

This can be accomplished by running the following command in the SQL tab of the phpMyAdmin on your service here:


UPDATE `dbname`.`wp_options` SET `option_value` = 'http://xxx.xxx.xxx.xxx' WHERE `wp_options`.`option_id` =1 AND `wp_options`.`blog_id` =0 AND CONVERT( `wp_options`.`option_name` USING utf8 ) = 'siteurl' LIMIT 1 ;

To revert back to your actual domain for the switch, this will do the job:


UPDATE `dbname`.`wp_options` SET `option_value` = 'http://example.com' WHERE `wp_options`.`option_id` =1 AND `wp_options`.`blog_id` =0 AND CONVERT( `wp_options`.`option_name` USING utf8 ) = 'siteurl' LIMIT 1 ;

You may need to do similar modifications to other apps. Always consult your software's documentation.

Database Connection Strings

Any website that utilizes a database needs to be able to make a connection. When moving to a new host, it is important to know where your database connection strings are located so you can update them to work with your new environment. Popular CMS applications such as Joomla, WordPress, Magento, Gallery and many others tell you what file to edit in the software documentation. For WordPress, this is in the wp-config.php file.

Via SSH

If you want to find all files containing a database connection string, run this from the httpdocs directory:


grep -rl "localhost" *

This will search all plain-text files for the string localhost and give you a simple list to go through. The reason we're searching for that is because localhost is the hostname that the majority of hosts use, so you have a good chance of finding your config file if you look for that phrase. You can set your new database username, password, and database name from inside of Plesk.

An example of the correct setting for a DV is:


// ** MySQL settings ** //
define('DB_NAME', 'dbname');// The name of the database
define('DB_USER', 'dbuser'); // Your MySQL username
define('DB_PASSWORD', 'tH15i5myP4SSW0rd'); // ...and password
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value

Test

Test using your IP address

Every DV includes the ability to test your site using your IP Address. The IP address is available in your AccountCenter and Service Activation Letter. For more information on setting the default domain for an IP, please read: How do I set the default site for IP address.

Change DNS settings

Before you change your DNS settings, have you:

  • Moved your website content.
  • Moved your databases.
  • Re-created your email users.
  • Previewed your site.

If you think you're ready to go, now is the time to switch your DNS! Go to your registrar and set your nameserver records to:

  • NS1.MEDIATEMPLE.NET & NS2.MEDIATEMPLE.NET

If you lowered your TTL and waited the original time interval, then the DNS propagation should be about 5 minutes. If you haven't, then you will need to wait for about 24-48 hours for DNS propagation to complete.

Double-check migration accuracy, cancel old service

Once you have fully tested your new server, and have confirmed that your DNS changes have propagated, you can close your old server.

You now have the option to update the primary domain of your new server, if desired.

Notes

  • SCP requires SSH access. Most modern hosts provide this, but check with your old hosting provider if you are unsure.
  • Before you can establish an SSH connection to your DV, you need to make sure the user for that domain has SSH access enabled.
  • You will need to have shell access at your old host for this method.
  • If you registered your domain with (mt) Media Temple, or if you transferred your domain here, you can change your nameserver settings from within your AccountCenter.