How to setup staging environments on Hostinger
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
Access Hostinger hPanel and navigate to subdomains
Create a staging subdomain
staging). Select your main domain from the dropdown menu. Set the document root to a new folder like /public_html/staging and click Create.Set up a separate database for staging
staging_db. Create a new database user or assign existing user permissions to this database. Note down the database credentials for later configuration.Copy your website files to staging directory
/public_html directory. Select all files and folders, then click Copy. Navigate to your staging folder /public_html/staging and paste the files there.Update configuration files for staging
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.Import database to staging environment
Test and configure staging environment
Set up automated backups and sync process
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.