certbot: Let's Encrypt certificate for nginx with HTTPS redirect and OCSP stapling
Single certbot command to obtain a certificate, configure nginx, redirect to HTTPS and enable OCSP stapling.
A certbot command that obtains a Let's Encrypt certificate and configures nginx in one go, with an HTTP to HTTPS redirect.
sudo certbot --nginx --agree-tos --redirect --staple-ocsp --email user@example.com -d app.example.com
| Option | Purpose |
|---|---|
--nginx |
use the nginx plugin to get the certificate and edit the configuration |
--agree-tos |
accept the certificate authority's terms of service |
--redirect |
automatically redirect HTTP to HTTPS |
--staple-ocsp |
enable OCSP stapling |
--email |
contact address for expiry notices |
-d |
domain name to certify |
Notes
- The domain must point to the server and port 80 must be reachable for validation.
- OCSP stapling depends on the certificate authority's OCSP support: check that it is still offered for your certificates.