A load balancer, uptime monitor or Docker healthcheck needs a URL that tells it whether nginx itself is alive. Pointing it at the home page mixes in the backend and fills the log.
location = /healthz {
access_log off;
default_type text/plain;
return 200 "ok\n";
}
location = matches only that exact path and is checked first, so it is cheap. return answers straight from nginx, with no file and no proxy. default_type makes the response text/plain instead of the default binary type, and access_log off keeps a check every few seconds out of your logs. curl -i then shows 200, Content-Type: text/plain and ok.
For a Docker healthcheck on the official alpine image, curl is already inside:
test: ["CMD", "curl", "-fs", "http://localhost/healthz"]
Know what it proves: nginx runs and answers. It says nothing about the app behind it. If you want the check to fail when the backend is down, proxy /healthz to the backend’s own health route instead. Put it in the server block that a request to localhost lands in, or the check hits your default server and gets a 404. I’d also keep it off the public internet with allow and deny lines if it exposes anything more than ok.
Further reading: return, location
Going deeper: Keep a domain pointed at your home with Cloudflare DDNS on Unraid