SSL certificate expiry is one of the most preventable outages in web infrastructure — yet it catches DevOps teams off-guard constantly. An expired cert on your Nginx server doesn't just degrade the experience: modern browsers block the request entirely, returning a full-page warning before users can even see your site. If the cert serves an API endpoint, every downstream client starts failing at the same moment.
The reason it still happens: the default workflow is manual. Someone checks the cert when they remember, adds it to a calendar, hopes the reminder fires on time, and eventually gets burned anyway. This article covers how Nginx SSL certificate monitoring should work and how to set it up properly.
The standard command-line check for any SSL cert is:
echo | openssl s_client -servername yourdomain.com \
-connect yourdomain.com:443 2>/dev/null \
| openssl x509 -noout -dates
This outputs the notAfter field — the expiry date. You can turn it into a cron-based alert with a few more lines:
#!/bin/bash
DOMAIN="yourdomain.com"
EXPIRY=$(echo | openssl s_client -servername "$DOMAIN" \
-connect "$DOMAIN:443" 2>/dev/null \
| openssl x509 -noout -enddate \
| cut -d= -f2)
EXPIRY_EPOCH=$(date -d "$EXPIRY" +%s 2>/dev/null \
|| date -j -f "%b %d %T %Y %Z" "$EXPIRY" +%s)
NOW_EPOCH=$(date +%s)
DAYS_LEFT=$(( (EXPIRY_EPOCH - NOW_EPOCH) / 86400 ))
if [ "$DAYS_LEFT" -lt 30 ]; then
echo "WARNING: $DOMAIN SSL cert expires in $DAYS_LEFT days" \
| mail -s "SSL Expiry Alert" ops@yourcompany.com
fi
Add it to crontab to run daily:
0 8 * * * /opt/scripts/ssl-check.sh >> /var/log/ssl-check.log 2>&1
This works for a single domain. It's what most teams start with.
The openssl + cron approach has hard limits that matter once your infrastructure grows:
mail is configured and the local MTA is working. On a fresh server or a container, that's usually not the case. The check runs silently and produces no output.openssl s_client doesn't reliably surface this.Proper Nginx SSL certificate monitoring has four properties:
SSLWatch monitors your Nginx SSL certificates externally and sends email alerts at 30, 14, 7, and 1 day before expiry. Enter a domain; get alerts. No agents to install, no scripts to maintain.
Join the SSLWatch waitlist → Check your cert now (free)SSLWatch is designed for exactly this use case: you enter a domain, and SSLWatch monitors the SSL certificate externally and emails you before it expires. It works for any Nginx-served domain — single server, reverse proxy, wildcard cert, or Let's Encrypt — without touching your Nginx config or server.
The alert schedule follows the tiers that matter in practice:
This is structurally different from a one-off script: the alerts repeat on a schedule you don't have to maintain. When you renew the cert, SSLWatch detects the new expiry and resets the alert window automatically.
cron or systemd timer that runs it is broken. SSLWatch catches the cases where Certbot's auto-renewal failed and you don't know yet.
Before setting up monitoring, check the current status of your cert. Enter your Nginx domain into the free SSL checker:
See your certificate's expiry date, issuer, and chain validity in seconds. No signup, no install.
Check your SSL cert →The checker shows you exactly what an external client sees when it connects to your domain — the same view a browser uses to validate the cert. If there's a mismatch between what Nginx serves and what you expect, it surfaces here.
The openssl command is useful for a one-time inspection. It's not a monitoring strategy. A monitoring strategy means:
Nginx SSL certificate expiry is a solved problem — the only reason it catches teams off-guard is because the default tooling requires you to set up something manually, and manual setups drift. External monitoring that sends alerts at 30, 14, 7, and 1 days is the durable answer.
SSLWatch monitors your Nginx SSL certificates and sends email alerts before they expire — at 30, 14, 7, and 1 day. Works with Let's Encrypt, Certbot, commercial certs, and wildcard domains.
Join the SSLWatch waitlist → Check your cert for free