How to make a WordPress staging area using Plesk

August 2, 2016

NOTE: This post was written before Plesk launched it’s Automated WordPress Toolkit 2.0 that includes automated staging Clone & Sync for WordPress. More here: Automate WordPress Workflow with Plesk WordPress Toolkit


This post was written to help our customers (and others) who are looking to easily make a staging environment for their WordPress website by using the tools built into Plesk. This process is designed to involve as little coding as possible. We’ve used a fictitious Campersunlimited.com domain as an example, you will want to use your domain in it’s place. So let’s get started!

  1. Log into Plesk (Server  Control Panel) If you are not sure how to do that have a look here
  2. The first thing you will want to do is to make a local copy of your site by zipping up and downloading your site files and database. You can easily do this with the file manager and database manager that is built right into Plesk. To access the file manager click on the the icon that looks like this in the main “Websites & Domains” area of Plesk :
  3. Now click on the checkbox at the top of the list so that it will select all the files and folders in the “httpdocs” folder like this:
  4. Now with all the items selected click on the “Add to Archive” button above the list of files (you can name the zip file whatever you wish and then you should download once it’s ready)
  5. Now from the main area of plesk go to the Database managment area, the Icon to get there looks like this:
  6. Here you can “Export Dump” your existing database in case you need it for any reason (you should also download this file for safekeeping as well)
  7. Now you can create a subdomain called “staging” (If you need detailed instructions on how to create a subdomain in Plesk here)
  8. Copy the existing files to the new subdomain with the built in “Copy Website” tool in Plesk, that looks like this:
    Select the new staging area from the drop down, then check the “delete all existing files” option and click OK like this:
  9. Now you will want to duplicate the database, you can do that by clicking on the “Databases” Icon in the main area of Plesk that looks like this:

    Next click on the “Copy” icon for the database associated with your WordPress site (if you are not 100% sure what database to choose have a look in the wp-config.php file to see what database WordPress is using):

    You will want to Create a NEW database and name it something like “staging-yourdomain” like this:
  10. Next you will need to make sure that your new database is connected to the DB user so that the server can access it by going to the “User Management” area for database that looks like this:

    make sure that the user has access to “ANY” databases like this:
  11. Now for the only editing of code you will need to change, in the new wp-config.php file (the one in the new subdomain area you made and copied the files too, not the original files) you need to edit the “DB_NAME” field so that it matches the new Database you made like this (we used the built in file manager to edit this file right in Plesk):
  12. Finally you are also going to want to add the following 2 lines to your wp-config.php file as well to tell WordPress that this version of the site has a different home page like this:
    If you want to copy and paste here is the text:

    define(‘WP_HOME’,’http://staging.YOURDOMAIN.com‘);
    define(‘WP_SITEURL’,’http://staging.YOURDOMAIN.com‘);

At this point once you save the changes you have made to your wp-config.php file and once your subdomain’s DNS has propagated (more on that here) when you go to your new subdomain you should see your website exactly as the original looks but as a complete and separate copy. You should be able to login with the same WordPress username and password and any changes you make will only be shown on the new staging site.

How To Make your WordPress staging site Go Live from your staging site in 3 steps:

Once you have made the changes and you are ready to go live with them, with the above in place it just takes a few minutes with these simple steps:

  1. Using the “Copy Website” tool in the staging area (not the one you used above when you moved the files from the main “live” site) to put the files into staging, move the files from the staging area to your main “Live” site (select “Delete all existing file”) like this:
  2. Now you could just switch the database so that it points to the one found in the staging area but that’s a very bad practice because you will probably want to have a staging area again one day and when you do you will break things if the actual live site is using a DB named staging so don’t do it! instead export the staging database using the export tool found the database management area of Plesk like this:
    _
  3. Now Import the file you just made into the the live database (and make sure you check the box “Recreate the database” in the process:
     _

That’s it, no DNS propagation, no FTP, not GIT, coding or anything else needed (smile)