# Build a public status page for your service

> A public status page tells users whether your service works right now; host it separately from the service it reports on and update it from a check script or a self-hosted status tool.

URL: https://levelrail.com/learn/monitoring/build-a-public-status-page/
Updated: 2026-11-27

A public status page tells users whether your service works right now and what happened recently. The simple version is a static HTML page that reads a `status.json` file, which your check script rewrites every minute. Host it away from the server it reports on, show when the data was last checked, and write incident notes in plain, specific words.

## How it works

Your check script from [uptime checks with a script and timer](https://levelrail.com/learn/monitoring/uptime-checks-with-a-script-and-timer/)) already knows if each component is up. Extend it so it writes a small JSON file after each run, and copy that file to a separate place that serves static files. The page loads `status.json` in the browser and shows one line per component. There is no database and no server code to attack. See [what to monitor first](https://levelrail.com/learn/monitoring/what-to-monitor-first/)) for which components belong on it.

What the page shows: the current state of each user-facing part (website, API, login), the time of the last check, and a short list of recent incidents. Do not show internal metrics. Users want to know "is it me or you", not CPU graphs.

## Step 1: Host it separately

Put the page where the outage cannot reach it: another VPS, a different provider or a static hosting service. If it lives on the server it reports on, it goes dark exactly when users look for it. A small nginx or Caddy on a second host is enough for a static page, as in [nginx from scratch](https://levelrail.com/learn/web-servers/nginx-from-scratch/)). Give it its own subdomain such as `status.example.com`, with HTTPS from [automatic HTTPS with Caddy](https://levelrail.com/learn/domains-https/automatic-https-with-caddy/)) or certbot. Also think about what else the two share. If both depend on the same DNS provider, a DNS failure takes both down.

## Step 2: Write status.json from the check script

Add this to the end of the check script, using the result variable `now` from the earlier lesson:

```bash
cat > /var/www/status/status.json.tmp <<JSON
{
  "checked_at": "$(date -u +%Y-%m-%dT%H:%M:%SZ)",
  "components": [
    {"name": "Website", "state": "$now"}
  ]
}
JSON
mv /var/www/status/status.json.tmp /var/www/status/status.json
```

Writing to a temporary file and renaming it means a visitor never reads a half-written file. Add one entry per component you check, and use the same logic for each URL. If the checker runs on a different machine from the page host, copy the file with `scp` or `rsync` over SSH using a limited key, as in [copy files with scp and rsync](https://levelrail.com/learn/server-basics/copy-files-with-scp-and-rsync/)).

## Step 3: Write the page

Create `index.html` next to `status.json`:

```html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Service status</title>
</head>
<body>
  <h1>Service status</h1>
  <ul id="components"></ul>
  <p id="checked"></p>
  <script>
    fetch("status.json", { cache: "no-store" })
      .then((r) => r.json())
      .then((data) => {
        const list = document.getElementById("components");
        data.components.forEach((c) => {
          const li = document.createElement("li");
          li.textContent = c.name + ": " + (c.state === "up" ? "Operational" : "Problem");
          list.appendChild(li);
        });
        const age = (Date.now() - Date.parse(data.checked_at)) / 60000;
        document.getElementById("checked").textContent =
          "Last checked " + data.checked_at + (age > 5 ? " (data is stale)" : "");
      })
      .catch(() => {
        document.getElementById("checked").textContent = "Status data unavailable.";
      });
  </script>
</body>
</html>
```

The page flags data older than five minutes as stale. Without that, a dead checker would keep saying everything works. Add a section below it for incident notes, written by hand.

## Step 4: Or use a self-hosted tool

Tools such as Uptime Kuma and Gatus run checks and serve a status page themselves. They save you writing the page, but you now run and update another service, and it still must live on a different host from what it monitors. Read each project's own documentation for features, installation and security advice before choosing. A script and a static file is fewer moving parts for a single service.

## Step 5: Write incident notes

When something breaks, add a note at the top within minutes, even if you know little:

```text
Investigating: Some users cannot log in (since 10:05 UTC)
10:12 UTC: We have found a failing database connection and are working on it.
10:40 UTC: Resolved. Logins work again. A full explanation will follow.
```

Say what users see, when it started, what you know and when the next update comes. Do not blame others or guess at causes. After a big incident, add a short written summary of what happened and what you changed. Keep old incidents visible for a while, since hiding them looks like hiding problems. Decide in advance who may post, so nobody waits for permission during an outage. The alerts that tell you something is wrong come from [alerting without alert fatigue](https://levelrail.com/learn/monitoring/alerting-without-alert-fatigue/)).

## Check it worked

- `curl -s https://status.example.com/status.json` returns fresh JSON with a recent `checked_at`.
- Opening the page shows each component and the check time.
- Stop the checker for ten minutes and confirm the page marks its data stale.
- Break the monitored service briefly and see the line change to Problem within a few minutes.
- The status host stays reachable when the main server is off.

## Edge cases and gotchas

- **Same failure domain.** Hosting on the same provider, region or DNS as the service can fail together. Separate what you can.
- **Stale green.** A page frozen on "Operational" is worse than no page. Always show the check time.
- **Over-sharing.** Do not publish internal hostnames, versions or error messages that help an attacker.
- **Flapping state.** Require two failed checks before showing a problem, or the page will blink on single dropped packets.
- **Overpromising wording.** Phrases like "100 percent uptime" invite disputes. Report what happened.
- **Caching.** If a CDN or browser caches `status.json`, visitors see old data. Serve it from the same origin as the page, with short cache headers.

## Troubleshooting

| Symptom | Likely cause | Fix |
| --- | --- | --- |
| Page shows `Status data unavailable.` | `status.json` missing or wrong path | Check the file exists and is readable by the web server |
| `SyntaxError: Unexpected token` in the console | Malformed JSON from the script | Validate with `python3 -m json.tool status.json` |
| Page always shows old data | Browser or CDN cache | Use `cache: "no-store"` and short cache headers |
| `scp: Permission denied` | Key or directory permissions | Fix ownership and the authorized key, see [log in with SSH keys](https://levelrail.com/learn/server-basics/log-in-with-ssh-keys/)) |
| Page shows Operational during an outage | Checker is dead or on the same host | Move the checker and show data age |
| `403 Forbidden` on status.json | Web server cannot read the file | Fix permissions on the directory |
| Mixed content warnings | Page on HTTPS fetches HTTP | Use relative URLs and HTTPS everywhere |
| Component never turns red | Check tests the wrong URL | Test a real page and its body |

## Quick reference

```bash
python3 -m json.tool /var/www/status/status.json
curl -s https://status.example.com/status.json
rsync -az status.json deploy@203.0.113.30:/var/www/status/
```

## Related lessons

- [Uptime checks with a script and timer](https://levelrail.com/learn/monitoring/uptime-checks-with-a-script-and-timer/)): the source of the state this page shows.
- [What to monitor first](https://levelrail.com/learn/monitoring/what-to-monitor-first/)): choose the components to list.
- [Monitor uptime simply](https://levelrail.com/learn/deploy-operate/monitor-uptime-simply/)): hosted checkers as an alternative.
- [Alerting without alert fatigue](https://levelrail.com/learn/monitoring/alerting-without-alert-fatigue/)): decide who hears about an outage before users do.
- [Nginx from scratch](https://levelrail.com/learn/web-servers/nginx-from-scratch/)): serve the static page.

Related post: [self-host a static site with Docker](https://levelrail.com/blog/self-host-static-site-docker/)).

## Next

Continue to the delivery side with [CI/CD pipeline stages explained](https://levelrail.com/learn/ci-cd/ci-cd-pipeline-stages-explained/)).

## Frequently asked questions

### What should a status page show?

The current state of each user-facing component, such as website, API and login, plus a short list of recent incidents with times and plain explanations. Keep it simple and accurate.

### Why host the status page somewhere else?

If it runs on the server it reports on, it goes down with it and tells users nothing when they need it most. Use a different host, provider or static hosting.

### Do I need a tool like Uptime Kuma or Gatus?

No. A static page and a script can be enough for one service. Self-hosted tools such as Uptime Kuma and Gatus add checks and a ready-made page, at the cost of running and updating them.

### How do I word an incident note?

State what users see, when it started, what you know and when you will update. Avoid blame and guesses, and mark it resolved with the time when it is fixed.


## Sources

- [MDN, Fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API)
