Blog

Infrastructure 10 min read

Website backup and monitoring: a practical plan for business owners

Most businesses discover their backup plan the day they need it. This guide explains how to set two numbers (how much data you can lose and how long you can be down), how to build backups that survive ransomware and human error, how to prove they work, and how to monitor the site so you hear about problems before customers do.

Cover illustration: Website backup and monitoring: a practical plan for business owners

TL;DR

  • Decide two numbers first: RPO (how much recent data you can afford to lose) and RTO (how long you can afford to be offline). Everything else follows from them.
  • Follow the 3-2-1 rule: three copies, two kinds of storage, one off-site. Add one copy that cannot be changed or deleted from your servers.
  • A backup you never restored is a guess. Schedule a restore test every quarter and write down how long it took.
  • Monitor from outside, watch real flows (login, checkout), and alert when a backup job does not run. Silence is the most dangerous failure.
  • The cost is mostly setup and testing time, not storage. A small business can have a solid setup in about a month.

When an online business loses its database, the cause is rarely dramatic. It is a bad deployment, an employee who deleted the wrong thing, a failed disk, a hosting provider incident, a compromised admin account or ransomware. What separates a bad afternoon from a damaged company is whether website backup and monitoring were set up and tested before it happened.

We run production systems for our own products and for clients, with automated health checks and error-log reviews on the servers. This is the setup we recommend to owners and managers, with enough technical detail to hand to your developer or hosting provider.

Start with two numbers: RPO and RTO

  • RPO (recovery point objective): how much recent data you can afford to lose. If it is 24 hours, a nightly backup is enough. If it is 15 minutes (a busy store with payments), you need frequent database backups or point-in-time recovery.
  • RTO (recovery time objective): how long the business can be down. If it is 4 hours, you need a documented restore procedure and a place to restore to. If it is 15 minutes, you need standby infrastructure, which costs more.

Estimate the cost of an hour of downtime for your business: orders lost per hour, plus staff time, plus the hit to trust. Even a rough number makes the right level of investment obvious and gives you something to show a CFO. Write the targets down by system, because they differ:

System                     RPO        RTO       Backup approach
Orders / payments DB       15 min     2 hours   Nightly full + binary log or frequent dumps
Customer uploads (files)   24 hours   8 hours   Nightly sync to object storage
Marketing website          24 hours   24 hours  Git repository + nightly backup
Internal admin tool        24 hours   1 day     Nightly dump

The 3-2-1 rule, plus one

  • 3 copies of your data: the live one and two backups.
  • 2 different kinds of storage: for example the server disk and cloud object storage.
  • 1 copy off-site in a different provider or region, so one outage or one account takeover does not take everything.
  • +1 copy that cannot be changed or deleted by the production system: object storage with versioning and object lock, or a write-only credential. This is what saves you from ransomware and from an attacker who gets into your server and deletes the backups too.

A snapshot offered by your hosting provider is helpful but is not enough on its own, because it usually lives in the same account and the same provider as the server it protects.

What to back up

  • The database. Usually the most valuable asset: orders, customers, content.
  • Uploaded files (images, documents, invoices) that are not in your repository.
  • Configuration and secrets needed to rebuild the system: environment files, server and web server configuration. Store these encrypted.
  • Code in a Git repository owned by your company. Deployed code on the server is not a backup of the repository.
  • DNS records and domain settings, exported from your registrar and DNS provider. Losing DNS access can take you offline for days.
  • Data in third-party systems (payment processor, CRM, email platform): export the important records on a schedule. Their uptime does not guarantee that your data is recoverable after a mistake.

A simple, reliable database backup script

This is a typical pattern for a PHP and MySQL site: dump, compress, encrypt, upload off-site, record success and ping an external monitor. Credentials live in a protected file, not on the command line:

#!/usr/bin/env bash
# /opt/backup/db_backup.sh
set -euo pipefail

STAMP=$(date -u +%Y%m%dT%H%M%SZ)
DIR=/var/backups/app
OUT="$DIR/db-$STAMP.sql.gz"

# credentials in /etc/app/backup.cnf (chmod 600) with [client] user=... password=...
mysqldump --defaults-extra-file=/etc/app/backup.cnf \
  --single-transaction --routines --triggers --no-tablespaces \
  "$DB_NAME" | gzip -9 > "$OUT"

# encrypt with a public key; the private key is stored offline, not on this server
age -r "$AGE_PUBLIC_KEY" -o "$OUT.age" "$OUT"
rm -f "$OUT"

# upload off-site (S3-compatible storage such as Amazon S3, Cloudflare R2 or Backblaze B2)
rclone copy "$OUT.age" remote:company-backups/db/ --immutable

# keep 7 days locally; use bucket lifecycle rules for long-term retention
find "$DIR" -name 'db-*.age' -mtime +7 -delete

touch "$DIR/last_success"
curl -fsS -m 10 --retry 3 "$HEALTHCHECK_URL" > /dev/null   # dead-man's switch ping
# crontab: nightly at 02:15 server time
15 2 * * * /opt/backup/db_backup.sh >> /var/log/db_backup.log 2>&1

Give the upload credential permission to add files but not to delete or overwrite them, and enable versioning or object lock on the bucket. For file uploads, rclone sync to a second bucket works the same way. For databases with tight RPO, add binary-log shipping or your provider's point-in-time recovery.

Test restores, or you do not have backups

The three most common backup failures are an empty dump, an expired credential that silently stopped uploads and an encryption key nobody can find. Only a restore test catches them. Do it on a separate machine, never over production:

age -d -i /secure/offline/key.txt db-latest.sql.gz.age | gunzip | mysql -u root restore_check
mysql restore_check -e "SELECT COUNT(*) AS orders FROM orders; SELECT MAX(created_at) AS newest FROM orders;"

Compare the counts and the newest record with production. Time the whole exercise: that is your real RTO, and it is usually longer than people expect. Repeat every quarter and after any major change, and keep a written runbook with the steps, the people and the access they need.

Monitoring: know before your customers do

Backups are about recovery. Monitoring is about noticing. A useful baseline for a business website:

  • Uptime checks from outside your own network, every one to five minutes, from more than one region. Check key pages and real flows (login, search, add to cart, checkout page), not only the homepage.
  • Certificate and domain expiry. Alert 30, 14 and 7 days ahead. An expired certificate or domain is a fully preventable outage.
  • Server health: disk space, memory, CPU and database connections. Disk full is the classic cause of "the site just stopped".
  • Application errors: a rise in 5xx responses or exceptions in the log, ideally through an error tracker.
  • Scheduled jobs and backups with a "dead-man's switch": the job pings a monitor when it succeeds, and you get an alert when the ping does not arrive.
  • Third-party dependencies: payment webhooks, email delivery, API quotas. A drop in events per hour is often the first sign of trouble.

A tiny health endpoint gives external monitors something meaningful to check. It should return only "ok" or "fail" to the public, and run honest checks behind it:

<?php
// public/health.php
header('Content-Type: application/json');

$checks = [];
try { $pdo->query('SELECT 1'); $checks['db'] = true; } catch (Throwable $e) { $checks['db'] = false; }

$checks['disk'] = (disk_free_space('/') / disk_total_space('/')) > 0.10;     // at least 10% free

$last = @filemtime('/var/backups/app/last_success');
$checks['backup'] = $last !== false && (time() - $last) < 26 * 3600;        // fresh backup in the last 26h

$ok = !in_array(false, $checks, true);
http_response_code($ok ? 200 : 503);
echo json_encode(['status' => $ok ? 'ok' : 'fail']);   // keep details in your logs, not in the response

Alerts that people actually act on

  • Two levels. "Wake someone up" for outages and failed backups, and "look tomorrow" for warnings. If everything pages, people mute everything.
  • A named owner and a backup person for each alert, with a phone number or chat channel that is actually watched.
  • Require the context in the alert: which check, since when, a link to the runbook.
  • A public or internal status page and a message template for customers, so communication during an incident is not improvised.
  • A short post-incident review after every outage: what happened, how long it took, what changes so it does not repeat.

A 30-day setup plan

  1. Week 1: inventory what runs where, define RPO and RTO per system, move accounts (hosting, DNS, domain, storage) under company ownership with multi-factor authentication.
  2. Week 2: implement database and file backups with off-site and immutable copies. Add the backup heartbeat.
  3. Week 3: set up external uptime checks, certificate and domain alerts, server and error monitoring, plus a health endpoint.
  4. Week 4: run the first full restore test on a clean machine, time it, write the runbook, and agree on who gets which alert.

After that, a quarterly restore test and a quick monthly review of alerts and storage costs keep it healthy. If you are still deciding what to do with an older system, our legacy code audit checklist covers backups, access and deployment as part of a broader review, and the PHP 8 upgrade guide shows how to stage a risky change safely with a rollback.

How we can help

We set up and maintain backups, monitoring and deployments for PHP platforms, including the restore tests and runbooks that most teams skip. See how we run payments and billing on infrastructure we operate in our PebbleHost project, learn about our integrations work for the systems your backups must also cover, or book a short consultation to review your current setup against the checklist above.

Frequently asked questions

How often should I back up my website?

Match it to the data you can afford to lose (your RPO). A content website may be fine with a nightly backup. A store that takes payments usually needs the database backed up every few minutes to an hour or point-in-time recovery, plus nightly file backups.

What is the 3-2-1 backup rule?

Keep three copies of your data, on two different kinds of storage, with one copy off-site. Many teams now add one more copy that cannot be modified or deleted from the production system, which protects against ransomware and account takeover.

Are my hosting provider's backups enough?

Usually not on their own. Provider snapshots often sit in the same account and region as your server, may be short-lived and are rarely tested by you. Keep an independent, encrypted, off-site copy and test restoring it.

How do I know my backup actually works?

Restore it on a separate machine on a schedule, check the data against production and time the process. Also alert on missing backups with a heartbeat monitor, so a silently failing job is noticed within a day.

What should I monitor on a business website?

At minimum: external uptime checks on key pages and flows, certificate and domain expiry, disk space and server load, application errors, scheduled jobs and backups, and the health of payment and email integrations. Send alerts to a named owner.

Free discovery call

Bring a messy stack or stalled integration - Integrono will map the smartest first move.

You get a senior take on budget traps, dependencies and whether to buy, glue or build - before paid work starts. The CEO stays in the loop.