
A backup you have never restored is a hope, not a backup. Here is a simple plan that works for a small self-hosted WordPress site.
3-2-1
- 3 copies of your data (the live site plus two backups),
- on 2 different kinds of storage,
- with 1 copy off the server — another provider or cloud drive.
What to back up
- The database — posts, pages, settings, orders.
wp-content— uploads, themes, plugins.wp-config.phpand your web-server config.
A nightly script
#!/bin/bash
D=$(date +%F); B=/backups/$D; mkdir -p $B
cd /var/www/example.com
wp db export $B/db.sql --allow-root
tar -czf $B/files.tgz wp-content wp-config.php
find /backups -maxdepth 1 -type d -mtime +14 -exec rm -rf {} + # keep 14 days
Run it from cron at a quiet hour, for example 30 2 * * * root /usr/local/bin/site-backup.
Advertisement
Get a copy off the server
Tools like rclone can copy the backup folder to Google Drive, OneDrive or object storage each night. Encrypt the copy if it contains customer data.
Test the restore
Every few months, restore the latest backup onto a test server or a local copy: import the database, unpack the files, open the site. Time it. That number is how long you would be down in a real emergency.
⚠️ Backups contain password hashes and customer data. Keep them out of the public web folder and limit who can read them.
✨ Ask AI about this article
Stuck on a step? Ask a question and the AI answers using this article.
Free · AI can be wrong