OCSP Stapling in NGINX: How It Works and Whether You Still Need It

OCSP stapling lets a web server fetch a signed, time-limited "this certificate is still valid" response from its certificate authority (CA) and send it to browsers during the TLS handshake. That saves each browser from contacting the CA itself, improving privacy and speed. In NGINX you enable it with ssl_stapling on; and ssl_stapling_verify on; plus the CA chain.

Jul 19, 2025 - 17:35
Updated: 
105.9k

Cybersecurity Foundations in Cybersecurity & Ethical Hacking · Troubleshooting

OCSP Stapling in NGINX: How It Works and Whether You Still Need It

Quick answer: OCSP stapling lets a web server fetch a signed, time-limited "this certificate is still valid" response from its certificate authority (CA) and send it to browsers during the TLS handshake. That saves each browser from contacting the CA itself, improving privacy and speed. In NGINX you enable it with ssl_stapling on; and ssl_stapling_verify on; plus the CA chain. However, the ecosystem has changed: Let's Encrypt ended OCSP support in favour of certificate revocation lists (CRLs), and the CA/Browser Forum made OCSP optional. Stapling now only matters if your certificate still includes an OCSP URL.

Key takeaways

  • OCSP answers "has this certificate been revoked?"
  • Stapling moves the OCSP query from the browser to the server.
  • Let's Encrypt certificates no longer carry OCSP URLs, so stapling does nothing for them.
  • Commercial CAs that still provide OCSP can benefit from stapling.
  • Test stapling with openssl s_client -status.

Table of Contents

How Does Certificate Revocation Work?

If a certificate's private key is compromised, the CA revokes it. Clients learn about revocation through certificate revocation lists (CRLs), downloadable lists of revoked serial numbers, or the Online Certificate Status Protocol (OCSP, RFC 6960), which answers for a single certificate. Browsers also use their own revocation data feeds.

What Problem Does Stapling Solve?

Client-side OCSPOCSP stapling
Who queries the CAEvery browserThe server, periodically
PrivacyCA learns which sites users visitCA sees only the server
SpeedExtra lookup during connectionResponse included in handshake
StandardRFC 6960TLS status_request extension, RFC 6066

What Changed in 2024 and 2025?

In July 2024, Let's Encrypt announced it would end OCSP and rely on CRLs, citing privacy and operating costs; it then removed OCSP URLs from its certificates and later shut its OCSP service down. The CA/Browser Forum Baseline Requirements made OCSP optional for publicly trusted CAs. Check your certificate for an OCSP URL:

openssl x509 -in /etc/ssl/certs/example.crt -noout -ocsp_uri
# no output means the certificate has no OCSP responder, so stapling is unnecessary

How Do You Configure Stapling in NGINX?

If your certificate still has an OCSP URL, use the NGINX ssl_stapling directives:

server {
    listen 443 ssl;
    server_name example.com;
    ssl_certificate         /etc/ssl/example/fullchain.pem;
    ssl_certificate_key     /etc/ssl/example/privkey.pem;
    ssl_trusted_certificate /etc/ssl/example/chain.pem;   # CA chain for verification

    ssl_stapling        on;
    ssl_stapling_verify on;
    resolver 1.1.1.1 9.9.9.9 valid=300s;
    resolver_timeout 5s;
}

Reload with sudo nginx -t && sudo systemctl reload nginx. NGINX fetches the response on demand, so the first connection after a reload may not include a staple.

How Do You Test It?

openssl s_client -connect example.com:443 -servername example.com -status < /dev/null 2>/dev/null | grep -A 3 "OCSP response"
# "OCSP Response Status: successful" means stapling works
# "OCSP response: no response sent" means no staple (normal for certificates without OCSP)

Use the Mozilla SSL Configuration Generator for current TLS settings.

What Are Common Problems?

  • No resolver set: NGINX cannot reach the OCSP responder.
  • Missing chain: verification fails without ssl_trusted_certificate.
  • Outbound firewall: the server cannot reach the CA's OCSP URL over HTTP.
  • Certificate has no OCSP URL: expected for Let's Encrypt today; nothing to fix.

Related: how TLS works and Linux server hardening. WebAsha offers Linux and web server security training.

References

Frequently Asked Questions

A TLS feature where the server includes a signed certificate status response from the CA in the handshake.

It avoids each browser contacting the CA, improving privacy and connection speed.

No longer. Let’s Encrypt ended OCSP in favour of certificate revocation lists.

Set ssl_stapling on, ssl_stapling_verify on, ssl_trusted_certificate and a resolver, then reload.

Run openssl s_client with -status and look for a successful OCSP response.

The CA/Browser Forum made OCSP optional; CAs may rely on CRLs instead.

Often because the certificate has no OCSP URL, the resolver is missing or the server cannot reach the CA.

A certificate revocation list, published by the CA, listing serial numbers of revoked certificates.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.