Follow

How to create staging sites

  • Applies to: Managed WordPress
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: AccountCenter Access
  • Applies to: Grid
    • Difficulty: Medium
    • Time Needed: 30
    • Tools Required: Account Center access
  • Applies to: DV
    • Difficulty: Easy
    • Time Needed: 10
    • Tools Required: AccountCenter Access, Plesk

Overview

Making a staging site a great way to test and preview changes to your website, before making it accessible to the public. The following article will explain how you can create a staging site on your server.

In essence, using a staging site entails:

  1. Copying your original site.
  2. Making changes on the copy.
  3. Switching your original site with the copy

In this example, we will be creating a staging site for a WordPress website. If you are using a different CMS, you may want to check with your website developer for your specific requirements, however the general concepts covered in this guide should still assist in creating your staging site.

Before Starting

It is highly advised that you create backups of your websites before making changes. If you'd like to see the backup options available for your server, feel free to view our additional documentation here. here.

NOTE:
Please keep in mind that troubleshooting the configuration/functionality of third-party applications is not covered by our statement of support. These resources were provided as a courtesy to assist you to the extent of our abilities. For more information on our statement of support, feel free to click here.

Instructions

Plesk

Service Provider View

Copy your website files to the staging site

  1. Log into the Plesk.
  2. Add a staging subdomain in Plesk.
    p0.5.png
  3. Navigate to the control panel for your domain in Plesk. Then click Website Copying.
    p1.png
  4. Select your desired settings for your Website Copying.
    p2.png
    • Website in Plesk: The staging site will be in this Plesk server.
    • Site name: Select the staging subdomain.
    • What to do with existing files: Choose whether to delete or keep any files on the staging subdomain. Do note that files with coinciding file names will be overwritten regardless.
  5. The click OK.
  6. Great! Your website files should now be copied to the staging site.

Copy your database

  1. Return the to control panel for the original site. Then click Databases.
    p3.png
  2. Locate your site's database. Then click Copy.
    p4.png
  3. Select your desired settings for your Database Copying.
    p5.png
    • Destination database server: localhost
    • Destination database: Create database with name. Then enter a desired database name.
    • Create a full copy: Ensure this is checked
  4. Then click OK.
  5. Great! Your database should now be copied and is prepared for staging.

UPDATE CONFIGURATION FILES/SCRIPTS:
After importing your database, you will likely need to make adjustments to your database, configuration files, and scripts in order for your staging site to use the staging database.

Push the staging site live

NOTE:
The following will OVERRIDE your existing website files. Before proceeding, it is highly recommended you have backups.

  1. Return the to control panel for the staging site. Then click Website Copying.
    p1.png
  2. Copy the staging files to your live domain.
    p2.png
  3. Click OK.
  4. You may again want to check your database, configuration files, and scripts for any staging dependencies and update those appropriately.
  5. That's it! The changes made on your staging site should now be live.
  6. If you wish to saver server space you can remove the staging subdomain from Plesk.
    p3.png

cPanel

Add a subdomain to your server

  1. Log into the cPanel account for your domain.
  2. Click on Subdomains.
    cp1.png
  3. Create a staging subdomain. Make a note of the Document Root, as this will be needed in the upcoming steps.
    cp2.png

Copy your website files to the staging site

Next you will want to copy your website data to the staging subdomain.

  1. Open the File Manager located in cPanel.
    cp0.5.png
  2. Navigate to the /public_html folder.
  3. Select all your website files (except the staging document root folder). Then select Copy.
    cp1.png
  4. Copy the files into the staging document root folder.
    cp2.png

Copy your database

  1. While in your cPanel account, click on MySQL databases.
    cp6.png

  2. Create a staging database.
    cp7.png
  3. Create a staging database user.
    cp8.png
  4. Add your staging user to the staging database. Provide the user will all permisions to the database.
    cp9.png
  5. Return to your cPanel account and click on phpMyAdmin
    cp6.png
  6. Export your website's database.
    cp13.png
  7. This will give you a SQL file.
    cp11.png
  8. Import the SQL file to your staging database.
    cp14.png

UPDATE CONFIGURATION FILES/SCRIPTS:
After importing your database, you will likely need to make adjustments to your database, configuration files, and scripts in order for your staging site to use the staging database.

Push the staging site live

NOTE:
The following will OVERRIDE your existing website files. Before proceeding, it is highly recommended you have backups.

    1. Return to the File Manager in cPanel.
    2. Navigate to your staging document root folder.
    3. Select all the staging files. Then click Copy.
      cp3.png
    4. Copy the files into the /public_html folder.
      cp4.png
    5. You may again want to check your database, configuration files, and scripts for any staging dependencies and update those appropriately.
    6. That's it! Be sure to check your website to ensure that it's functioning as desired.
    7. If you wish to save server space you can remove the /public_html/staging folder.

Instructions

Add a subdomain to your server

First, we will want add a subdomain for us to work on the staging site.

  1. Log into your Media Temple Account Center
  2. Add a subdomain to your server. In this example we will be using staging.example.com.

    Be sure to replace example.com with your actual domain name.
    g-1.png

Copy your website to the staging site

Next you will want to copy your websites data to the staging site.

Option 1: Use a plugin such as WP Staging or Duplicator.

Do keep in mind these some of these may require a premium membership in order to utilize certain key features.

Option 2: Use FTP for a manual transfer.

The following is using Filezilla (3.14.1)

  1. Connect to your server through FTP.
  2. Navigate and download the /html folder of the original site. For information on how to locate this folder, you can view our article on website root.
    FTP-1.png
  3. Transfer the folder contents into the /html folder of the staging site.
    FTP-2.png

Copy your database

You will also want to copy your website's database to the staging site.

  1. Export the database from the original site.
    db-1.png
    Exporting your database should give you a SQL file.
    sql.png
  2. Create a new database for your staging site. In this example we've named the new database _staging.
    db-2.png
  3. Create a new database user. In this example, we've created a user name _staging. Then give the new user Read/Write permissions to the staging database.
    db-3.png
  4. Import the SQL file into the staging database.
    db-4.png

    You may need to make some temporary changes to the database to make it work on the staging site.

  5. In this example, we had to navigate to _options.
    gdb-1.png
  6. Then clicked on the db-5.1.png icon to change the home and siteurl to the staging site.
    Original:
    gdb-2.png
    Staging:
    gdb-3.png
  7. You will also want to go into the wp-config.php file of the staging site and update the DB_NAME, DB_USER, and DB_PASSWORD to the staging database.
    gdb-3.png

Make your desired changes

Make your desired changes on the staging site. As you can see, the original site has not been affected.

In this example, we have changed the theme and site title of the staging site.

staging-1.png

Push the staging site live

When you are ready, you can switch the staging site with the original site.

In this example, we will be using File Manager, however the same task can be done using FTP or SSH.

  1. Navigate to the folder path /domains/example.com. And click on the gear.png icon.

    Be sure to replace example.com with your actual domain name.
    g-1_2.png
  2. Change the name of the original site.

    In this example, we are changing, mt-domain.com to old.mt-domain.com. This will effectively "disable" the original site.
    g-1.png
  3. Now click on the gear.png icon for the staging site.
    g-1_3.png
  4. Change the staging folder name, to the original folder name.

    In this example, we are changing staging.mt-domain.com to mt-domain.com. This will effectively make the staging site replace the original site.
    g-1.4.png
  5. Your end result should look something like this.
    g-2.png
  6. Lastly, you will want to go into the staging database and change any staging URLS accordingly.
    Change From:

    db-1.png
    Change to:
    gdb-2.png
  7. Great! Your staging site should now be live, and your original site will now live under the old.example.com URL.
    g-5.png
  8. If you wish to save server space, you can use FTP to download/backup the old.example.com folder onto your computer, then remove it from the server.

Instructions

Adding a staging site

  1. Log into the Account Center.
  2. Click the ADMIN button for the Managed WordPress service you want to work with.
    mwp1.png
  3. Hover your cursor over the site slot you want to create a staging site for. Then click MANAGE SITE.
    mpw2.png
  4. Click Developer Tools from the menu on the left.    
    dev_tools 
  5. This will bring up the staging panel. Click on Add staging site to create a new staging site. You will have 2 available slots if you have not staged a site for this domain before.
     empty_staging
  6. The staging site will begin to provision itself. This can take up to three minutes to fully complete.
    2078_creating_staging
  7. The new staging site will then appear in one of the slots and you can begin customizing its look and functionality.
    staging_panel

 

Syncing a staging site

  1. When you are done making your changes, click on MANAGE for the staging site you wish to sync.
    staging_panel 
  2. Click Sync Sites from the Staging Site menu on the left.
    sync_sites 
  3. Click SYNC TO PRODUCTION to sync your staging site to your domain.    
     
  4. When the sync is complete you will be asked to verify the changes.
    2078_sync_complete

Removing a staging site

  1. Click on the X icon to the right of the staging site.
    staging_panel 
  2. Lastly, click on YES, DELETE THIS STAGING SITE to completely remove your staging site.
    2078_delete_staging
Was this article helpful?
1 out of 1 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk