Website staging with Plesk Onyx
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.
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.
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)
The process is really quick and helps you to easily keep track of all of your different types of environment (staging or production).
2. Use a separate webspace on the same server
Go to Websites & Domains and select 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.
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:
- Go to the Websites & Domains, find the website you want to copy, then select Website Copying.
- Select the file destination option
- On the same server
You 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.
Copy your database
If your website uses a database you may need to copy this also.
- Select Databases from the left main menu.
- Find the database you need to copy and click the Copy icon.
- Next, you’ll need to choose the destination of the database copy.
- If you 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).
- 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.
- The database copying process will start immediately.
- 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:
- Go to Websites & Domains
- Locate the address of your production site in the list of domains
- 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.
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.