Want to Set Up a Staging WordPress Site on DigitalOcean (Complete Guide)
A staging site is a clone of your live WordPress site that you can use to safely test changes, updates, new plugins, or themes — without affecting your live site.
In this guide, we’ll walk you through the process of setting up a WordPress staging environment on DigitalOcean, ideal for site owners, developers, and DIYers who want more control over their hosting.
🚀 Why Use a Staging Site?
- Test plugin/theme updates before applying them live
- Try design and content changes safely
- Debug errors without affecting live users
- Build new features without downtime
📋 Prerequisites
Before you begin, you need:
- A live WordPress website
- A DigitalOcean account
- Basic knowledge of SSH and server management (or use a control panel like RunCloud/ServerPilot/CyberPanel)
Option 1: Manual Setup on a New Droplet (Advanced Users)
Step 1: Create a New Droplet
- Log into DigitalOcean
- Click Create → Droplet
- Choose Ubuntu LTS (e.g., 22.04)
- Choose your plan (Basic 1GB RAM is fine for staging)
- Select a datacenter near you
- Set authentication (SSH key recommended)
- Click Create Droplet
Step 2: Set Up the Server Stack (LEMP/LAMP)
You can install WordPress manually or use tools like:
- EasyEngine (for Nginx + Redis)
- WordOps (optimized LEMP stack)
- ServerPilot (commercial)
- Or manually install Apache/Nginx + PHP + MySQL
For example, to install LAMP manually:
sudo apt update && sudo apt upgrade
sudo apt install apache2 mysql-server php libapache2-mod-php php-mysql unzip curl
Step 3: Create a Database for Staging
sudo mysql -u root -p
CREATE DATABASE staging_db;
CREATE USER 'staging_user'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON staging_db.* TO 'staging_user'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 4: Clone Your Live Site
- Export your live site database using phpMyAdmin or WP Migrate DB
- Copy your WordPress files from the live site using:
scp
command (for SSH)- Or a backup plugin (like UpdraftPlus, Duplicator)
- Upload your files to
/var/www/staging-site
- Update
wp-config.php
with new DB details - Import database to staging server
mysql -u staging_user -p staging_db < your_live_site.sql
Step 5: Update Domain for Staging
Use a subdomain, e.g. staging.yoursite.com
- Add a new A record in your DNS pointing
staging
to the new droplet IP - Update Apache/Nginx virtual host for
staging.yoursite.com
- Restart server:
sudo systemctl restart apache2
Step 6: Block Search Engines and Add Basic Auth
In robots.txt
:
User-agent: *
Disallow: /
Add HTTP Basic Auth:
sudo apt install apache2-utils
htpasswd -c /etc/apache2/.htpasswd yourusername
Then add this to your Apache conf:
<Directory "/var/www/staging-site">
AuthType Basic
AuthName "Restricted"
AuthUserFile /etc/apache2/.htpasswd
Require valid-user
</Directory>
Option 2: Use a Droplet Snapshot (Quick & Clean)
- Take a snapshot of your live WordPress Droplet
- Create a new Droplet from that snapshot
- Change the site URL in the database:
- Use WP-CLI:
wp search-replace 'https://yoursite.com' 'https://staging.yoursite.com' --skip-columns=guid
- Update DNS to point
staging.yoursite.com
to new droplet IP - Lock it down with robots.txt and basic auth
Bonus: Use Tools Like RunCloud or SpinupWP
If you want to avoid managing the stack yourself:
- Use RunCloud, ServerPilot, or SpinupWP
- Connect your DigitalOcean server
- Create a staging WordPress site from the panel with one click
Maintenance Tips
- Always update your staging site when you update live
- Test every update on staging before pushing live
- Periodically clear cache and backups to save space
Summary
Setting up a staging site on DigitalOcean gives you full control, but also requires some tech know-how. You can either do it manually, from a snapshot, or using control panels like RunCloud. The extra effort is worth it for the peace of mind and professionalism it adds to your workflow.
Leave a Reply