How to setup staging environments on Hostinger

intermediate 8 min read Updated 2026-04-20
Quick Answer

Create a staging environment on Hostinger by setting up a subdomain through hPanel, installing your website files via File Manager, and configuring a separate database. This allows you to test changes safely before deploying to your live site.

Prerequisites

  • Active Hostinger hosting account
  • Live website already deployed
  • Basic understanding of file management
  • Access to your domain's DNS settings

Step-by-Step Instructions

1

Access Hostinger hPanel and navigate to subdomains

Log into your Hostinger hPanel dashboard and select your hosting account. Navigate to Domains section and click on Subdomains. This is where you'll create a separate environment for your staging site.
Choose a subdomain name like 'staging' or 'dev' to clearly identify it as a test environment.
2

Create a staging subdomain

Click Create Subdomain and enter your desired subdomain name (e.g., staging). Select your main domain from the dropdown menu. Set the document root to a new folder like /public_html/staging and click Create.
The subdomain will be accessible at staging.yourdomain.com once DNS propagates (usually within 24 hours).
3

Set up a separate database for staging

Go to Databases in your hPanel and click MySQL Databases. Create a new database with a name like staging_db. Create a new database user or assign existing user permissions to this database. Note down the database credentials for later configuration.
Keep staging and production databases separate to avoid accidentally affecting live data during testing.
4

Copy your website files to staging directory

Open File Manager from hPanel and navigate to your main website's /public_html directory. Select all files and folders, then click Copy. Navigate to your staging folder /public_html/staging and paste the files there.
This process may take several minutes depending on your website size. You can also use FTP clients for faster transfers.
5

Update configuration files for staging

In your staging directory, locate and edit configuration files like wp-config.php (WordPress) or .env files. Update database connection details to point to your staging database. Change any absolute URLs to use your staging subdomain instead of the live domain.
Make sure to update any hardcoded URLs in your configuration to prevent staging from affecting your live site.
6

Import database to staging environment

Go to phpMyAdmin in hPanel and select your staging database. Click Import tab and upload your live site's database backup file. If you don't have a backup, export it first from your live database using the Export tab.
After importing, update any URLs in the database that still point to your live domain using phpMyAdmin's search and replace feature.
7

Test and configure staging environment

Visit your staging subdomain in a browser to verify everything works correctly. Test key functionality like forms, user registration, and content management. Configure any necessary redirects or security settings specific to your staging environment.
Consider adding password protection to your staging site to prevent search engines from indexing it.
8

Set up automated backups and sync process

In hPanel, go to Backups and ensure your staging environment is included in regular backups. Consider setting up a process to periodically sync your live database to staging for testing with current data while being careful not to overwrite staging-specific configurations.
Document your staging setup process and create a checklist for updating staging when making significant changes to your live site.

Common Issues & Troubleshooting

Staging subdomain shows 404 or doesn't load

Check that DNS has fully propagated (can take up to 24 hours). Verify the document root path is correct in Subdomains settings and ensure files exist in the specified directory.

Database connection errors on staging site

Double-check database credentials in your configuration files. Ensure the database user has proper permissions and the database name matches exactly what you created in MySQL Databases.

Images or assets not loading on staging site

Update absolute URLs in your database and configuration files to use the staging subdomain. Use search and replace in phpMyAdmin to change yourdomain.com to staging.yourdomain.com throughout the database.

File permission errors or unable to upload files

Check file permissions in File Manager. Set folders to 755 and files to 644. If using WordPress, ensure the staging directory has write permissions for plugin/theme updates.

Prices mentioned in this guide are pulled from current plan data and may change. Always verify on the official Hostinger website before purchasing.