Website backups are like insurance: you do not appreciate them until you need one. A bad theme update, a hacked admin account, an accidental file deletion, or a corrupted database can all take your site offline. Without a backup, recovering from any of these scenarios means rebuilding from scratch — which can take days or weeks and cost thousands of dollars in lost revenue.
This tutorial covers four backup methods, from beginner-friendly cPanel tools to advanced SSH scripts. We also cover how to restore from a backup when things go wrong.
The 3-2-1 Backup Rule
Before diving into the methods, understand the golden rule of backups:
- 3 copies of your data (the original plus two backups)
- 2 different storage types (e.g., server + cloud storage)
- 1 copy offsite (not on the same server as your website)
A backup stored on the same server as your website is not a real backup. If the server fails, you lose both your site and your backup. Always store at least one copy in a separate location like Google Drive, Dropbox, Amazon S3, or a local hard drive.
What Should You Back Up?
A complete website backup includes two parts:
- Files: All website files including HTML, CSS, JavaScript, images, plugins, themes, uploads, and configuration files (like
.htaccessandwp-config.php). - Database: The MySQL database containing your content, pages, posts, comments, user accounts, settings, and plugin data.
You need both. Restoring files without the database gives you an empty website shell. Restoring the database without files gives you content with no design or functionality.
Method 1: Full Backup via cPanel
cPanel includes a built-in backup tool that creates a compressed archive of your entire hosting account, including all files, databases, email accounts, and settings.
Creating a Full Backup
- Log in to your cPanel dashboard.
- Go to Files → Backup Wizard (or Backup for the advanced view).
- Click Back Up (Step 1).
- Select Full Backup.
- Choose the backup destination:
- Home Directory: Saves the backup to your hosting account (quickest, but uses your disk space).
- Remote FTP Server: Sends the backup to an external FTP server.
- Remote FTP Server (passive): Same as above but uses passive FTP mode.
- SCP (Secure Copy): Sends the backup to a remote server via SSH.
- Enter your email address to receive a notification when the backup is complete.
- Click Generate Backup.
The backup process runs in the background. Depending on the size of your account, it can take anywhere from a few minutes to an hour. You will receive an email when it is done.
Downloading Partial Backups
If you only need to back up specific parts of your account, cPanel lets you download partial backups:
- Home Directory: Downloads a compressed archive of all files.
- MySQL Databases: Downloads individual database SQL dumps.
- Email Forwarders and Filters: Downloads email configuration data.
Important: Full cPanel backups cannot be restored through cPanel itself — they require your hosting provider to restore them. For self-service restoration, use partial backups (files + database separately) or one of the methods below.
Method 2: Database Backup via phpMyAdmin
For a quick database-only backup (useful before updating WordPress or running database operations):
- In cPanel, go to Databases → phpMyAdmin.
- Select your WordPress database from the left sidebar.
- Click the Export tab.
- Select Quick export method and SQL format.
- Click Export. Your browser will download a
.sqlfile containing the entire database.
Restoring a Database from phpMyAdmin
- Open phpMyAdmin and select your database.
- If restoring over existing data, click Operations and select Drop all tables first. (Be very careful with this step.)
- Click the Import tab.
- Click Choose File and select your
.sqlbackup file. - Click Import. The database will be restored.
Method 3: SSH Backup Script
For developers and advanced users, SSH provides the fastest and most flexible backup method. You can create scripts that back up both files and databases, compress them, and upload them to cloud storage automatically.
Manual SSH Backup
Connect to your server via SSH and run these commands:
# Create a dated backup directory
mkdir -p ~/backups
# Back up all website files
tar -czf ~/backups/files-$(date +%Y%m%d).tar.gz -C ~/public_html .
# Back up the MySQL database
mysqldump -u dbuser -p'dbpassword' dbname > ~/backups/database-$(date +%Y%m%d).sql
# Compress the database dump
gzip ~/backups/database-$(date +%Y%m%d).sql
Replace dbuser, dbpassword, and dbname with your actual database credentials (found in wp-config.php for WordPress sites).
Automated Daily Backups with Cron
Create a backup script and schedule it to run daily using cron:
- Create the backup script:
#!/bin/bash
# backup.sh - Daily website backup script
BACKUP_DIR="$HOME/backups"
DATE=$(date +%Y%m%d-%H%M)
SITE_DIR="$HOME/public_html"
DB_NAME="your_database"
DB_USER="your_dbuser"
DB_PASS="your_dbpass"
# Create backup directory
mkdir -p "$BACKUP_DIR"
# Backup files
tar -czf "$BACKUP_DIR/files-$DATE.tar.gz" -C "$SITE_DIR" .
# Backup database
mysqldump -u "$DB_USER" -p"$DB_PASS" "$DB_NAME" | gzip > "$BACKUP_DIR/db-$DATE.sql.gz"
# Delete backups older than 30 days
find "$BACKUP_DIR" -type f -mtime +30 -delete
echo "Backup completed: $DATE"
- Make it executable:
chmod +x ~/backup.sh - Add a cron job in cPanel (Cron Jobs section) or via command line:
# Run daily at 3:00 AM
0 3 * * * /home/username/backup.sh >> /home/username/backups/backup.log 2>&1
Method 4: WordPress Backup Plugins
If you are running WordPress, backup plugins offer the most user-friendly experience with cloud storage integration:
UpdraftPlus (Recommended)
- Install and activate UpdraftPlus from Plugins → Add New.
- Go to Settings → UpdraftPlus Backups.
- Click the Settings tab and configure:
- Backup schedule: Daily for files, daily for database.
- Retention: Keep the last 14 backups.
- Remote storage: Choose Google Drive, Dropbox, Amazon S3, or another cloud provider. Authenticate with your account.
- Click Save Changes.
- Click Backup Now to create your first backup immediately.
Restoring with UpdraftPlus
- Go to Settings → UpdraftPlus Backups.
- Under "Existing Backups," find the backup you want to restore.
- Click Restore.
- Select which components to restore (plugins, themes, uploads, database, other).
- Click Restore and wait for the process to complete.
"The best backup is one you have tested. Create a backup, then practice restoring it on a staging site. If you have never restored a backup before, you do not actually have a backup — you have a file you hope works."
Restoring a Full cPanel Backup
If you created a full cPanel backup and need to restore it:
- Contact your hosting provider. Full cPanel backups must be restored by the server administrator. Open a support ticket with Serverlys and provide the backup file.
- If you have SSH access and the appropriate permissions, you can use the cPanel restore API, but this requires root or reseller access.
Restoring Files from a Partial Backup
- In cPanel, go to Backup → Restore.
- Under "Restore a Home Directory Backup," click Choose File.
- Select the compressed home directory backup file.
- Click Upload. cPanel will extract the files to their original locations.
Restoring a Database from a Partial Backup
- In cPanel, go to Backup → Restore.
- Under "Restore a MySQL Database Backup," click Choose File.
- Select the
.sqlor.sql.gzbackup file. - Click Upload. The database will be restored.
Serverlys Tip: All Serverlys hosting plans include automatic daily backups with 30-day retention. You can restore from any backup point with one click through your control panel. No manual backup scripts needed. See plans.
Backup Best Practices
- Automate everything. Manual backups are backups you will forget to make. Set up automated daily backups.
- Store backups offsite. Use Google Drive, Dropbox, Amazon S3, or another cloud provider. Never rely solely on server-side backups.
- Test your backups. Restore a backup to a staging environment at least once a month to verify it works.
- Back up before changes. Always create a manual backup before updating WordPress core, themes, plugins, or making database changes.
- Keep multiple versions. Retain at least 30 days of daily backups. Some problems (like malware) are not discovered immediately.
- Monitor backup success. Check your backup logs or email notifications regularly to ensure backups are completing successfully.
Frequently Asked Questions
How often should I back up my website?
Daily is the minimum recommendation. If your site changes frequently (ecommerce stores with new orders, active blogs with daily posts), consider multiple backups per day. The goal is to minimize data loss — if your latest backup is 24 hours old, you lose up to 24 hours of changes in a disaster.
How much storage do backups need?
A typical WordPress site with a 500MB file directory and a 100MB database creates backups around 150–200MB when compressed. Keeping 30 daily backups requires roughly 5–6 GB of storage. Cloud storage for this amount costs $1–2/month.
Can I restore a backup to a different hosting provider?
Yes. If you have separate file and database backups, you can restore them on any hosting account. Upload the files via FTP, import the database via phpMyAdmin, and update wp-config.php with the new database credentials.
What is the difference between incremental and full backups?
A full backup copies everything every time. An incremental backup only copies files that have changed since the last backup. Incremental backups are faster and use less storage, but restoration requires the full backup plus all subsequent incremental backups.
Will backups slow down my website?
Backups use server resources (CPU and I/O) while they are running. Schedule backups during low-traffic hours (e.g., 3:00 AM) to minimize impact. On well-provisioned servers, the performance impact is negligible.