🧯 How to Restore VPS from a Backup
Data loss on a VPS can occur due to various reasons: software failure, update errors, hacking, or accidental deletion. Luckily, if you have a backup, you can restore your VPS to its previous state. This article walks you through the steps to restore your website, database, configuration files, and permissions.
📦 Step 1: Prepare the Backup
- 📁 Make sure you have a
.tar.gz
archive or similar - 📂 Extract the archive to a safe directory:
tar -xzf backup.tar.gz -C /restore/
- ☁ If the backup is on a remote server, download it using
rsync
orscp
🗂 Step 2: Restore Website Files
Transfer your website files to the working directory (e.g., /var/www/html
):
rsync -av /restore/site/ /var/www/html/
Check permissions and ownership:
chown -R www-data:www-data /var/www/html chmod -R 755 /var/www/html
🧠 Step 3: Restore the Database
- Create the database (if missing):
CREATE DATABASE dbname;
- Import the SQL dump:
mysql -u root -p dbname < /restore/db.sql
- Check the site’s DB connection (
config.php
,.env
, etc.)
🔧 Step 4: Restore Configs and Crontab
If your backup includes configs:
- Restore
/etc/nginx/
,/etc/php/
,/etc/mysql/
if needed - Check and restart services:
systemctl restart nginx php mysql
- Restore cron jobs:
crontab /restore/crontab.backup
🛡 Tips from Bit.Hosting
- 🧪 Test site functionality after restore
- 📧 Ensure mail sending, SSL, and DB connections work
- 🔒 Don’t forget to update software and secure the system post-recovery
- 📤 Keep backups for at least 7 days on external storage
If you have questions or need help restoring your VPS — contact Bit.Hosting support. We’ll get your server back online quickly! 🛠