I recently tried to access a website I’d created for a South Korean start-up over 2 years ago only to find that the entire contents of the web directory had been deleted. Within a day or two of this realization, the CEO contacted me and asked me to “fix” it.
Luckily for me, Dreamhost had updated the site in the last year and had created a complete archive of the site at /sitename.com.old
. But, I didn’t want to run into this situation again in the future without a backup, so I decided to create a staging site for it. This was to accomplish 3 things:
- To maintain a FULL copy of the functioning website (as it is now)
- To teach me how to create a staging site so I can repeat the process with my personal sites
- To allow me to make changes to my websites that are not “live” – to test and debug them before implementing the changes on my “live” sites
Thankfully, Dreamhost and the Duplicator plugin make this process pretty painless. Here are the steps I took:
#1 Dreamhost
1. Create a .dreamhosters.com
subdomain
Dreamhost provides FREE subdomains on the .dreamhosters.com
domain to its customers. This is a recommended location to create a staging site. The following article outlines this process:
Creating a Staging WordPress site – Dreamhost Help
When you create the .dreamhosters.com
subdomain, be sure to assign the same user to it as you are using for the original site. This will make the next step much easier.
2. Copy ALL files to the new subdomain
Personally, I’ve found it much much faster and easier to ssh
into my site and copy all the files using the command line (rather than via FTP). For this to work, you’ll need to keep a few things in mind:
- Your FTP user needs Shell access (Enabling Dreamhost Shell Access).
- The same user needs access to BOTH the original site and the new subdomain so that when you
ssh
in, you can run the Linux copy command from the root folder. - Now, in a Terminal window,
ssh
into the site, and run the following command to copy all site contents to the new subdomain.
[server]$ cp -a originalsite.com/. staging.dreamhosters.com
We’re copying the files over NOW because Dreamhost Shared hosting won’t allow us to create and download large archives with the Duplicator plugin. So it’s better to do the Two-Part Install instead of relying on Duplicator for the entire process.
#2 Duplicator
1. Install & run Duplicator on the original site
Dreamhost has a helpful article that lays out this process.
Migrating WordPress to DreamHost using the Duplicator plugin
But, rather than downloading the FULL SITE archive, we need to run the Two-Part Install – downloading only the database archive and installer file.
2. Create a new Database on Dreamhost
Complete step #8 from the previous article to create a new MySQL database on Dreamhost:
Creating a MySQL database – Dreamhost Help
3. Upload & run installer.php
on the staging site
Continue the Migration tutorial from step #9. Upload BOTH the archive.zip
and the installer.php
files from Duplicator to your staging site via FTP. Then, navigate to the installer on your staging site:
http://stagingsite.dreamhosters.com/installer.php
When it asks for your database details, be sure to “Test Database” to make sure you can connect. Then run through the rest of the steps in the installer.
Also remember to “Remove installer files” after logging into your new /wp-admin
area (there will be a link).
Review & Resources
Overall, the process of setting up a WordPress Staging Site with Dreamhost and Duplicator was much easier than I’d originally anticipated. Here is a condensed list of the steps and resources covered in the tutorial above.
Tools
Steps
- Create a
.dreamhosters.com
subdomain (with the same user) - Copy over ALL original site files (via
ssh
and the command line) - Install Duplicator and run it to archive “Database Only”
- Upload the
archive.zip
andinstaller.php
to your subdomain - Create a new MySQL database in Dreamhost (same user)
- Navigate to
subdomain.dreamhosters.com/installer.php
- Run through the remainder of the steps in the tutorial
Tutorials
- Dreamhost’s Migration tutorial
- Duplicator’s Two-step Install tutorial
- See also: Staging a DreamPress overview for tips on best practices:
Bonus: Get $50 off Dreamhost’s Unlimited shared hosting plan by clicking this link, or any of the other Dreamhost links above!
Disclaimer: (I will make a small commission if you decide to sign up for a Dreamhost plan using one of these links)
where can I find a service to install my hosting?
I have my hosting through Dreamhost (who I highly recommend). There are many links throughout this post to their hosting site. Here’s another.