Create the root folders on the server
On the new server create the root for each WordPress site under
sudo cd /var/www/
sudo mkdir /var/www/mydomain.com
To avoid updating the Apache config files, this should be the same folder structure as on the legacy server.
Apache config files
Make a backup of the default Apache config files on the target server.
Create a zip file with the configuration
sudo zip new-apache-config-files.zip *.conf
Copy the zip file to somewhere where you can access it with a browser.
sudo cp /etc/apache2/sites-available/new-apache-config-files.zip /var/www/html/new-apache-config-files.zip
Copy the Apache config files from the legacy server and place them on the new server.
Create the zip file with the configuration:
sudo zip old-apache-config-files.zip *.conf
Copy the Apache config file to somewhere the zip file can be accessed with a browser if needed.
sudo cp /etc/apache2/sites-available/old-apache-config-files.zip /var/www/html/old-apache-config-files.zip
On the target server download the config files.
sudo wget http://www.domainname.com/old-apache-config-files.zip
Unzip the Apache config files on the new server
sudo unzip old-apache-config-files.zip
sudo mv *.conf /etc/apache2/sites-available
Activate the websites on the new server
It is time to activate the sites on the new server.
sudo cd /etc/apache2/sites-available
Enable the Apache config files
sudo a2ensite *.conf
Restart Apache and verify that it works
sudo service apache2 restart
After the migration, remove the zip files:
sudo /var/www/html/rm *.zip
Recommended procedure for migration and testing without downtime
Leverage the power of the hosts file
- You can migrate and test without changing the domain records. All you do is modifying the hosts file on your PC. This enables you to test the new server before actually changing the records in DNS.
- This way you can perform the migration with no downtime. Here is a list of graphical tools you can use to edit your hosts file on OS X and Windows. When something gets broken, then you can fix it without downtime. When you finally change DNS to go live on the server. Then you have already tested that everything is working.
Time for creating RDS database
- Create the database on the new Amazon AWS RDS server. You can do this using the command-line or graphical tools like Sequel Pro, MySQL Workbench or Navicat. Use the favorite of your choice. The easiest way is often to tunnel trough EC2 to RDS using SSH.
Activate WordPress and restore
- Install an empty WordPress site using the old manual way, by using WP-CLI or WordShell.
- Restore UpdraftPlus Backups from the legacy server to the new, fresh WordPress JeOS VPS server.
- Test that the site works correctly by changing the hosts files instead of changing public DNS for the domains
- Go live by changing public DNS.