Working with a Staging Site

If you have a production website and are planning major site changes, consider setting up a staging site — a separate location on the server where you can conveniently update and test a copy of the site before putting it into production.

We recommend that you work with a staging site in the following way:

  1. Decide where you want to host the development copy and prepare the development environment. You can choose to host it in the same subscription, in a separate subscription on the same server, or upload it to an FTP account on another server.

    If you choose the same subscription, then you first need to set up a new website by adding a domain or a subdomain.

  2. (Optional step.) If you set up your development environment under your account in Plesk and your production site has APS applications installed via Plesk (at the Applications section), install the desired site applications in your development environment in the same subdirectory as you have on your production site. This step is optional; however, it will help you avoid changing manually database connection settings in the application scripts.
  3. Make a copy of the website and place it in the staging environment.
  4. Make copies of the databases used by the site and deploy them in the staging environment.
  5. Change database connection settings in the scripts to point at the databases in the staging environment.
  6. (Optional step.) Complete APS applications setup. Go to the Applications section for your development site, locate the application in the list of installed applications, open its Settings screen and re-save the parameters. With this operation, the APS scripts should stop pointing at the production database and reconnect the application to the database copy. This step is needed if your production site has APS apps installed via Plesk and you performed Step 2 of the current instruction.
  7. Make the required changes to the site copy in the staging environment, and test them to make sure everything works as intended.
  8. Publish the updated site. This is done by pointing the document root of the production site to the staging site location.

To set up a site for staging purposes:

  1. Go to Websites & Domains.
  2. Click either Add Domain or Add Subdomain.

    We recommend that you use a subdomain for staging purposes.

  3. Proceed as described in Adding Domains or Adding Subdomains.

If you do not want your staging site to be accessible to the Internet users, do not register the newly added domain or subdomain name with a domain name registrar, or use an .htaccess file (on Linux hosting) to restrict access to it.

To make a copy of website files:

  1. Go to Websites & Domains and find the name of the website you want to copy.
  2. Click Website Copying.
  3. To copy website files to the document root of an existing site:
    1. Select the option Website in Plesk.
    2. Select the destination site from the Site name menu.
    3. Specify what to do with the files that might already be present in the destination directory.
  4. To copy website files to an FTP account on this or another server:
    1. Select the option FTP storage.
    2. Specify the server's host name and credentials for connecting to the FTP account.
    3. In the FTP connection method field, leave the Active mode option selected. If Plesk fails to connect to the external FTP account, select the Passive mode option here.
  5. Click OK.

If the site uses scripts that work with a database, copy the database to the staging environment:

  • If the database is hosted on the same server (managed by Plesk), use the procedure below to copy it.
  • If the database is hosted on another server which (not managed by Plesk), use the mysqldump utility to export the database, move the resulting data dump file to the staging environment and deploy it there. Modify the site's scripts in the staging environment so that they connect to the copied database.

To make a copy of a database from the Plesk-managed server:

  1. Go to Websites & Domains > Databases.
  2. Click Copy in the databases list for the database you want to copy.
  3. Specify the following:
    • Destination database server. You can select the same Plesk-managed database server, or a database server located elsewhere. For an external database server, specify the host name or IP address, and access credentials: the username and password of a database management system user authorized to create databases and database tables.
    • Destination database. You can choose to create a database or copy the data to an existing database.
    • Create a full copy. Leave this option selected to copy the database structure and all data.
  4. Click OK.

    The copy of the database will be deployed on the destination server.

  5. Modify the site's scripts in the staging environment so that they connect to the copied database.

When the site copy in the staging environment is updated and ready to go live, publish it as described in the following steps.

To publish the updated site to the production environment:

  1. Go to Websites & Domains.
  2. In the list of domain names, locate the address of your production site and click it.
  3. In the Document root box, specify the document root directory of the staging site.
  4. Click OK.

This will make the updated site copy in the staging site location accessible to visitors of your production site address.

 

Leave your feedback on this topic here

If you have questions or need support, please visit the Plesk forum or contact your hosting provider.
The comments below are for feedback on the documentation only. No timely answers or help will be provided.