How to properly use certbot with Nginx on Ubuntu?
Install and configure NGINX:
The /etc/nginx/sites-available/MYSITE
config file should look like
so:
Install certbot:
Create the certificate:
You could potentially use the --must-staple
argument to enable the
OCSP “must staple” extension, but it doesn’t work well with Firefox
(to fix in your Firefox browser: go to about:config,
and set security.ssl.enable_ocsp_must_staple
to false
).
The arguments are:
--nginx
: Use NGINX for authentication and install certificate for NGINX--agree-tos
: Agree with Let’s Encrypt terms of service--redirect
: Add NGINX config to redirect HTTP to HTTPS--uir
: AddContent-Security-Policy: upgrade-insecure-requests
to HTTP responses--hsts
: AddStrict-Transport-Security
header to HTTP responses--staple-ocsp
: Enable OSCP stapling (allow browser to skip verification of whether the SSL certificate has been revoked or not)--email
: Email address to use to register with Let’s Encrypt, and potentially for recovery