A backup is useful only if it can be restored within an acceptable time and produces a consistent application. A complete web-hosting recovery plan normally includes application code, configuration, uploaded files, databases, scheduled tasks, certificates or renewal configuration, and the operational notes needed to rebuild the service.
Define recovery objectives
Set a recovery point objective (RPO): how much recent data can be lost? Set a recovery time objective (RTO): how long can the service remain unavailable? These targets determine backup frequency, retention, replication, and restore design. A daily backup may be adequate for a low-change brochure site but not for a transactional application.
Back up each data class
Code can often be redeployed from version control, but configuration and user-generated data need deliberate protection. Database backups should use a method appropriate to the engine and workload. For a logical MariaDB dump:
mariadb-dump --single-transaction --routines --triggers appdb > appdb.sql
This option is suitable for transactional tables such as InnoDB; it does not make every storage engine or external dependency consistent automatically. Protect the dump, verify its exit status, and encrypt off-server copies.
Test restoration
Restore into an isolated environment, not over the live site. Import the database, restore uploads, apply configuration, and verify ownership and permissions. Test login, critical workflows, scheduled tasks, and file downloads. Measure the time required and record missing dependencies.
Protect backup integrity
Keep at least one copy separate from the production server and restrict who can delete it. Use encryption where backups contain secrets or personal data. Monitor backup age and job failures, and periodically verify checksums or perform a full restore. A backup process that reports success but produces a zero-byte or incomplete archive must be treated as failed.
Document the recovery sequence, credentials access process, DNS changes, and rollback criteria. Repeat restore drills after major architecture changes, not only once during initial setup.