How to set up a staging environment
Updated 7/20/2026
A staging environment is a copy of production where you test changes before they reach customers. It catches problems before they hurt.
What must be identical
- The same operating system and software versions.
- The same web server and database configuration.
- Representative test data (no real sensitive data).
1. A separate server
Cleanest is a dedicated VPS for staging. With hourly billing, you can start a staging server only while you test and delete it after, paying very little.
2. A separate subdomain
staging.example.com A STAGING_SERVER_IP
3. Protect it
Staging should not be indexed by Google or publicly accessible. Add basic authentication and a robots.txt that blocks indexing.
4. Copy data from production
Periodically bring a copy of the database, see migrating a database, but anonymize sensitive customer data.
The full flow
You develop locally, deploy to staging, test, then deploy to production, ideally through a CI/CD pipeline.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to create a systemd service for your app
Make your app start automatically and restart itself if it stops, with a systemd service.
Updated 7/20/2026Dev environmentsHow to keep sessions running after disconnect with tmux
tmux keeps your terminal sessions alive even after you close SSH, ideal for long-running tasks.
Updated 7/20/2026Dev environmentsHow to install PHP (multiple versions) and Composer
Install the PHP version your project needs, along with Composer for package management.
Updated 7/20/2026