Website staging with Plesk

All good developers know it’s important to test your code before publishing it to live, and the easiest way to do this is using a website staging environment. This allows you to ensure your code is stable and tested, to prevent unwanted outages due to glitches which can affect your users and cost your business money.

Plesk Panel allows you to setup a website staging environment to check that everything runs smoothly before pushing your code into production.

The action plan

Before proceeding with this you should decide where you want to host the staging environment. You have three options: use the same webspace, create a new one or upload it to an FTP account on another server.

1. Host it in your current webspace

If you decide to host the staging website in the same webspace you will need to first create a new domain or a subdomain. We will quickly guide you through these steps.

Creating a new domain

To add a new domain to your existing webspace simply go to Websites & Domains and select Add Domain.

add_domain

Next, select which domain name you wish to use, choose the correct webspace in case there are multiple ones and set up hosting type and settings depending on your needs.

add_new_domain_same_webspace

Creating a subdomain

If you already have a domain you can easily add a new subdomain to it and use that for testing (e.g. staging.yourdomainname.com or similar)

add_subdomain

The process is really quick and helps you to easily keep track of all of your different types of environment (staging or production).

add_subdomain

2. Use a separate webspace on the same server

Go to Websites & Domains and select Add Domain.

add_domain

Fill in the name of your domain and select the option Create a new webspace. Select the IP you want to host the domain on (this is optional, you can safely use the same IP) and fill in your desired login credentials. They will be used for FTP and SSH access.

add_domain

3. Upload it to an FTP account on another server.

You can connect to any FTP server, whether hosted by us or another provider, using your FTP account username and password.

We don’t recommend using an external FTP account as the server environment you are testing on is likely to be configured differently to the server you use for your production website and your testing might not identify all problems. If you have multiple servers hosted by us, our support team will be happy to verify they are both configured the same for you.

Copy the website

Now that you’ve decided on the location of your staging environment and configured it, you need to copy everything from the production environment to the staging environment using the following steps.

How to copy website files:

  1. Go to the Websites & Domains, find the website you want to copy, then select Website Copying.
    copy_website
  2. Select the file destination option
    • On the same server file_copyYou can either keep or delete any existing files on the destination server before copying them, but please note that if there are any files with the same name on the destination server they will always be overwritten.
    • On another server, using the FTP storage option. Specify the server’s host name and credentials for connecting to the FTP account.FTP storage
      Use the Active mode option in the FTP connection method field. If you can’t manage to connect to the external FTP account, try again with the Passive mode enabled.

Copy your database

If your website uses a database you may need to copy this also.

  1. Select Databases from the left main menu.
  2. Find the database you need to copy and click the Copy icon.copy database
  3. Next, you’ll need to choose the destination of the database copy.
  • If your want to copy the database to a new or existing database on the same server, select the destination server, Webspace and enter a new database name or select from existing databases.
    We recommend you use the “create a full copy box” if you want the full database copied, or deselecting this option if you only want the database structure to be copied (such as if you are planning to populate the database with test data).
    copy_database
  • If you want to publish the database to a separate server, you will need to specify the host name (or IP address) of the remote server to create the new database or overwrite an existing database.copy_database

     4. The database copying process will start immediately.

     5. Once the copy has completed, you should modify your site’s scripts in the website staging environment so they connect to the copied database, such as by modifying connection strings to connect to a new database name, username and password.

From website staging to production

When the site copy in the staging environment is updated and ready to go live, you can publish it:

  1. Go to Websites & Domains
  2. Locate the address of your production site in the list of domains
  3. In the document root box, update the document root directory with the one of the staging site and click OK.

Don’t forget to adjust your database connection strings if needed to connect to your live database.

All the changes you’ve made to the site will now be visible to the external users.

14
1045

Need More Help?

If you're still having problems, get in touch with our 24/7 support team! We'll be more than happy to help.