What Is a Staging Environment? Setting One Up for Your Website
What is a staging environment and why do you need one? A test site on a subdomain, copying the database, password protection, noindex and going live.

Contents
A staging environment is a test environment where a copy of your live website runs and changes are tried before they go live. You try plugin and theme updates, new PHP versions, design changes and new features on staging first; if everything works, you move them to the live site. That way, when an update breaks the site, only you see it, not your visitors.
This guide covers why you need a staging environment, how to set one up on web hosting and on your own server, how to protect the staging site and how to move changes to live safely.
Why should you use a staging environment?
- Updates can break the site. A plugin update or a new PHP version can cause a white screen or a 500 error. Trying it on staging first prevents downtime on the live site.
- Design and content changes. You can prepare a new theme or page layout without visitors seeing it.
- Teamwork. You can show changes to your client or your team without putting them live.
- Debugging. You can safely investigate problems that are risky to reproduce on the live site.
Ways to set up staging
| Method | When it fits |
|---|---|
| Subdomain on the same hosting | Most WordPress and PHP sites |
| Staging plugin | Small WordPress sites, a quick copy |
| Separate site on your own server | Custom applications, Laravel and Node.js projects |
| Separate server | Heavy tests that must not affect live at all |
Setting up staging on web hosting
- Create a subdomain. In your control panel, create a subdomain such as
staging.yourdomain.com; the panel prepares a separate folder for its files. The steps are in our What is a subdomain? article. - Copy the files. Compress the live site's files with the file manager, copy them to the staging folder and extract them there.
- Create a separate database. Export the live database from phpMyAdmin, then create a new database and user and import it. The staging site must never connect to the live database.
- Update the configuration. Enter the new database details in the staging copy's configuration file (
wp-config.phpin WordPress). - Change the site address. WordPress stores the site address in the database. Update the addresses in the staging database to
staging.yourdomain.com; use a search-and-replace plugin orwp search-replacewith WP-CLI for this. Don't run a plain find-and-replace directly in the database; serialized data can break.
These steps are almost the same as moving a site; the details are in our How to migrate a website guide.
Staging on your own server
On your own server, staging is set up as a separate site:
- Use a separate folder, a separate database and a separate
.envfile for staging (APP_ENV=staging). - In Nginx, create a separate server block for the staging subdomain.
- If you use Git, feed the staging server from a separate branch (for example
developorstaging); changes merged into the main branch go live, and the staging branch is deployed to staging. We cover automated deployment in our How to deploy with Git guide.
Protect the staging site
A staging site shouldn't be open to everyone:
Password protection. Put a password on the staging folder with Directory Privacy in your control panel or a similar feature. If you use Nginx:
location / {
auth_basic "Staging";
auth_basic_user_file /etc/nginx/.htpasswd-staging;
}
You can create the password file with the htpasswd tool (the apache2-utils package on Ubuntu).
Hiding it from search engines. A staging site showing up on Google can lead to duplicate content problems. Password protection largely prevents this; in addition, add a noindex header to every page:
add_header X-Robots-Tag "noindex, nofollow" always;
In WordPress, you can also tick the option to discourage search engines on the Settings → Reading page. Be careful not to carry this setting over to live.
Turn off email and payments
The staging copy contains your live site's user and customer list. If you don't take precautions:
- A test on staging can send order or newsletter emails to real customers.
- Scheduled tasks can run the same jobs as the live site a second time.
To prevent this, turn off email sending on staging or redirect all emails to a test address; switch payment gateways to test (sandbox) mode and remove the live API keys from staging. If possible, anonymize personal data in the staging copy.
Moving changes to live
- Back up the live site first.
- Move code and settings. Put theme, plugin and code changes live with Git or a file transfer.
- Be careful with the database. Uploading the staging database to live as it is deletes the orders, comments and users created on live after the staging copy was made. In most cases only code and settings are moved; you make content changes on live, or apply database changes with migrations.
- Check on live. Try important pages, forms and payment steps again.
- Refresh staging regularly. The staging copy drifts away from live over time; take a fresh copy from live before major changes.
We cover backup habits in our Server backups guide.
Staging with Nodesty
On Nodesty web hosting plans, you can set up your staging site on the same account by creating a subdomain and a separate database through cPanel or DirectAdmin; the number of subdomains and databases you can create depends on the plan limits, and free SSL is available for every subdomain. With JetBackup, you can reach your live site's backups from the control panel. If you want to set up a separate staging server for your application, our AMD Ryzen 9 9950X VPS plans offer full root access.
Frequently Asked Questions
Do I need separate hosting for a staging environment?
Usually not. You can set up a staging site on the same hosting account with a subdomain and a separate database. If you run heavy tests, or heavy jobs that must not affect the live site at all, a separate account or server is safer.
Will my staging site show up on Google?
If you don't take precautions it can, and because it carries the same content as your live site, it can be treated as duplicate content. Password-protect the staging site and use a noindex tag or an X-Robots-Tag header so search engines don't index it.
How do I move changes from staging to the live site?
Moving code and theme changes with Git or a file transfer is easy. Be careful when moving the database; orders, comments and users created on the live site after the staging copy was made are lost when you upload the staging database to live. In most cases only code and settings are moved, and the content stays on live.
Can a staging site send emails to live customers?
Yes, it can if you don't take precautions; the staging copy contains the live site's user and customer list. Turn off email sending on staging, or use a setting that redirects all emails to a test address.
Can I use a staging plugin for WordPress?
Yes. Some plugins copy the site with one click to a subfolder or a subdomain on the same account. For large sites and custom configurations, a manually set up staging environment gives more reliable results.
What's the difference between staging and a development environment?
A development environment is usually the one on the developer's own computer, where changes are made. Staging is an environment that resembles the live server as closely as possible, where changes are tried one last time before going live.
About the author
Nodesty Team · Infrastructure & Support
The Nodesty team runs our servers, network and DDoS protection day to day and answers customer support requests around the clock. These guides come from that work.
Related articles

What Is a Subdomain and How Do You Create One?
What is a subdomain and how do you create one? Subdomains with DNS records, creating one in cPanel and DirectAdmin, pointing it to a game server, and SSL.

What Is Bandwidth and Traffic? Calculate Your Needs
What is bandwidth, and how does it differ from traffic? Mbps vs. MB/s, port speed, unlimited traffic, sizing for websites and game servers, and monitoring.

How to Change the PHP Version and php.ini Settings
How to change PHP version: choosing a version in cPanel and DirectAdmin, upgrading safely, and php.ini settings like memory_limit and upload_max_filesize.