If you don’t want to use Certbot’s -i nginx
feature (or equivalently --nginx
instead of certonly
), I would suggest putting your dummy cert in a different path, say /etc/letsencrypt/dummy
instead of /etc/letsencrypt/live
. After your first certbot certonly
run, you could then run
sed -i 's/dummy/live/' /etc/nginx/whatever.conf
to change the reference in the configuration file.
There is a way to create the entire /etc/letsencrypt
structure with a dummy cert from the outset, but it’s not documented and requires a bit of manual work, so I don’t think I would suggest that.
The method suggested by @Osiris is intended to create the HTTPS virtual host for you where it didn’t already exist. This is what most people prefer to do if they don’t already have a certificate, but I’m sure there are configurations in which people don’t prefer that.