How to back up a WordPress site, step by step
Updated 7/20/2026
A complete WordPress backup has two parts: the site files (themes, plugins and uploads in wp-content, plus wp-config.php) and the database. Here is how to save them.
1. Back up the files
cd /var/www/html
tar -czf /mnt/backup/wp-files-$(date +%F).tar.gz wp-content wp-config.php
2. Back up the database
Find the database name and user in wp-config.php:
mysqldump -u wp_user -p wordpress | gzip > /mnt/backup/wp-db-$(date +%F).sql.gz
3. Restore
Unpack the files back into the site folder and re-import the database:
gunzip < wp-db-2026-07-18.sql.gz | mysql -u wp_user -p wordpress
4. Automate with cron
0 3 * * * cd /var/www/html && tar -czf /mnt/backup/wp-files-$(date +\%F).tar.gz wp-content wp-config.php && mysqldump -u wp_user -pPASSWORD wordpress | gzip > /mnt/backup/wp-db-$(date +\%F).sql.gz
Keep backups on a Backup Box
Mount a Backup Box as an extra disk and write the copies straight there. That way, if the server fails or a plugin breaks the site, you restore quickly from a safe copy. The address, username and password are on the Backup Box page in your panel.
apt-get install -y cifs-utils
mkdir -p /mnt/backup
mount -t cifs //BACKUP_BOX_ADDRESS/backup /mnt/backup -o username=USER,password=PASSWORD,vers=3.0
See also the guide The best VPS for WordPress.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
How to mount a Backup Box on Windows and share it with users
Mount a Backup Box as a network drive on Windows via SMB and share it with your team: common storage, accessible like a normal disk.
Updated 7/20/2026BackupHow to back up a Laravel application, step by step
A complete Laravel backup: code, .env, storage and database, plus how to send it all to a Backup Box mounted as an extra disk.
Updated 7/20/2026BackupHow to back up a PostgreSQL database, step by step
A complete PostgreSQL backup guide: pg_dump, cron automation and how to send copies to a Backup Box mounted as an extra disk.
Updated 7/20/2026