
Nginx is one of the most widely deployed web servers in the world — serving as a reverse proxy, load balancer, and HTTP server for millions of production applications. While Nginx is known for its reliability and performance, it can still fail: processes crash, configuration changes break routing, upstream servers become unavailable.
Effective Nginx server monitoring combines external HTTP checks with process-level monitoring to give you complete visibility.
Understanding potential failure points helps you set up the right monitoring:
nginx -s reload with a bad config causes nginx to fail to startExternal HTTP monitoring catches most of these. If nginx is down for any reason, HTTP checks fail.
The most important check is an external HTTP uptime monitor pointing at your server's domain or IP:
Monitor: https://yourdomain.com
Method: GET
Expected status: 200
Interval: 1 minute
Content check: verify page title or unique content
This confirms nginx is running and serving your application correctly. If nginx crashes, this check fails and you receive an alert.
Configure multi-location monitoring to check from multiple geographic regions — a network issue or CDN problem might make your server unreachable from some locations while appearing fine from others.
Nginx includes a built-in status module (ngx_http_stub_status_module) that exposes connection statistics:
# In your nginx config
server {
listen 127.0.0.1:80;
location /nginx-status {
stub_status;
allow 127.0.0.1;
deny all;
}
}
This gives you active connections, accepted requests, and handled connections — useful for spotting connection exhaustion.
For external monitoring, add a dedicated health location that your monitoring tool can reach:
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
Monitor https://yourdomain.com/health for a fast, lightweight availability check.
Nginx in reverse proxy mode forwards requests to an upstream application (Node.js, Python, PHP, etc.). Even if Nginx is running perfectly, a down upstream server causes 502 Bad Gateway errors.
Set up separate monitoring for your upstream application's health endpoint. For example:
localhost:3000, add a monitor for https://yourdomain.com/api/health (which routes through Nginx to your Node.js app)Also monitor the upstream application's heartbeat if it's a long-running process.
External HTTP checks confirm your service is accessible from the outside. For server-level process monitoring, use your operating system's process management tools.
Configure Nginx as a systemd service with automatic restart:
# /etc/systemd/system/nginx.service
[Service]
Restart=always
RestartSec=5
This restarts Nginx automatically if it crashes. External monitoring detects if the restart loop is failing (Nginx keeps crashing) or if the recovery takes longer than expected.
Note the difference:
nginx -s reload — gracefully reload configuration; workers finish existing requests before reloadingsystemctl restart nginx — full stop and restart; brief unavailabilityAfter any configuration change, test with nginx -t before reloading to catch syntax errors that would prevent nginx from starting.
If Nginx handles SSL termination, monitor your certificate:
server {
listen 443 ssl;
ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;
}
An expired or missing certificate causes nginx to fail to start (or serve SSL errors to users). SSL certificate monitoring with 30-day advance alerts ensures you're never caught with an expired certificate.
Nginx access and error logs contain valuable information for diagnosing issues:
/var/log/nginx/error.log — captures nginx errors, upstream connection failures, permission issues/var/log/nginx/access.log — all requests with status codesWhile log monitoring is separate from uptime monitoring, setting up log aggregation (ELK stack, Loki, Papertrail) means you have detailed context available when your uptime alerts fire.
| Failure | What You See | Check Type |
|---|---|---|
| Process crash | HTTP timeout/refused | External HTTP monitor |
| Config error after reload | HTTP timeout | External HTTP monitor |
| Upstream down | 502 Bad Gateway | External HTTP monitor |
| SSL cert expired | SSL handshake error | SSL certificate monitor |
| Port conflict | Nginx fails to start | External HTTP monitor |
| Disk full | 500 errors | External HTTP monitor + disk alert |
Domain Monitor provides external HTTP monitoring that catches all of these failure modes from outside your infrastructure.
For a production Nginx server, configure:
Use a 2-failure confirmation count to avoid false alarms from brief network blips between the monitoring server and yours.
Monitor your Nginx server uptime at Domain Monitor.
Generative AI creates new content — text, images, code, and more. This guide explains how it works, what tools are available, and where it's genuinely useful versus overhyped.
Read moreCursor AI is an AI-powered code editor built on VS Code. Learn what it does, how it works, and whether it's the right tool for your development workflow.
Read moreClaude Opus is Anthropic's most capable AI model, built for complex reasoning and demanding tasks. Learn what it does, how it compares, and when to use it.
Read moreLooking to monitor your website and domains? Join our platform and start today.