Creating a staging site manually
Creating a staging site
A staging site is a safe copy of your live site where you can test changes, updates, or new features without risking downtime or breaking your main site. It allows you to check plugin/theme updates, try out custom code, or redesign your site before deploying those changes live.
This guide walks you through setting up a manual staging site in cPanel. The process involves creating a subdomain, copying your site files, duplicating your database, and updating the site to use the new staging environment.
We’ll be staging a WordPress site in this guide, but the process is the same for any website — just update the configuration files to match your specific application.
Create a Subdomain
- Log in to cPanel.
- Go to Domains → Domains.
- Click Create A New Domain.
- Enter your staging URL (e.g.
staging.yourdomain.com
). - Untick Share document root so the subdomain has its own folder.
- Confirm and create.
- cPanel will set up a folder, usually
/staging.yourdomain.com
Copy Your Website Files
Option A: cPanel File Manager
- Open File Manager.
- Go to your live site folder (Usually
/public_html/
). - Select all files → Copy → choose the staging folder (
/staging.yourdomain.com
).
Option B: FTP Client
- Connect via FTP.
- Download all files from
public_html
. - Upload them to
/staging.yourdomain.com
.
Export the Database
- In cPanel, open phpMyAdmin.
- Select your live site’s database from the left menu.
- Click Export at the top → Quick → SQL → Go.
Create a New Database
- In cPanel, go to MySQL® Database Wizard.
- Enter a name for the staging database (e.g.
stagingdb
). - Create a new database user (e.g.
staginguser
) with a strong password. - Assign the user to the database with All Privileges.
- Note down the database name, username, and password — you’ll need them.
Import the Database
- In cPanel, open phpMyAdmin.
- Select the new staging database.
- Click Import, upload your
.sql
file, then click Go.
Update wp-config.php
- Open
/staging.yourdomain.com/wp-config.php
in File Manager. - Update the database settings:
define('DB_NAME', 'user_stagingdb');
define('DB_USER', 'user_staginguser');
define('DB_PASSWORD', 'yourpassword');
define('DB_HOST', 'localhost');
- Save the file.
Update WordPress Site Links
If you can log in:
- Go to
staging.yourdomain.com/wp-admin
. - Install and run Better Search Replace.
- Replace all
yourdomain.com
withstaging.yourdomain.com
.
If you cannot log in:
- In phpMyAdmin, open the staging database and find the
wp_options
table. - Once located, find and update the
siteurl
andhome
values to your staging URL. - Then log in and install the Better Search Replace plugin and complete the above replacement.