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.
CloudTech Can Help!
Media Temple offers site migrations via CloudTech, our premium services division. To learn more, please click here.
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.
- Lower the TTL for the domain(s) you will be migrating.
- Set up the new server.
- Back up all website content, databases, and emails from your current host.
- Upload files and import your databases to your new hosting service at (mt) and re-create any email accounts.
- Update database connection strings and system paths to match the environment.
- Test the site using your IP address.
- Change DNS settings.
- 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.
Order the server
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.
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 * firstname.lastname@example.org:httpdocs/
This should transfer all of the files directly to your DV from the old host.
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
- Log into your old host's phpMyAdmin panel and click on your database on the left hand side.
- Now that your database is selected click on the "Export" tab at the top.
- Please make sure you have selected the appropriate options in the screenshot below.
- Save the file, making sure to select "zipped" under "Compression". This will greatly reduce the size of your database file.
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.
- First we create the dump:
mysqldump â€“-add-drop-table -uusername -p [password] databasename > mysqlbackup.DATE.sql
- Then we transfer it over
scp mysqlbackup.DATE.sql email@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.
- 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.
- 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.
- 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.
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.
- Click Domains >example.com > Databases > Database Name > DB Webadmin to reach phpMyAdmin for your domain.
- From the column on the left, select the database that you want to restore to.
- 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.
- 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
- Log into your DV server using SSH. Then navigate to your data directory. This is where we transferred our backup to earlier.
- First, we establish the connection:
- Then we change directories:
- 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.
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 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.
- 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.