Renewing Certificats and configuring on windows 10

I think this older advice is not ideal for our Windows users. Sorry! I will try to get it updated to something more appropraite.

In general, it's easiest to include the --pre-hook and --post-hook when you first create the certificate.

For example:

certbot certonly -d example.com --standalone --pre-hook "net.exe stop apache2.4" --post-hook "net.exe start apache2.4"

Running this would result in these two lines being present in C:\Certbot\renewal\example.com.conf:

pre_hook = net.exe stop apache2.4
post_hook = net.exe start apache2.4

like this:

image

What you can do is add these lines to this file, and next time Certbot's scheduled renewal task runs, it will appropriately stop and start the Apache server, if renewal is required.

You can then also test renewal with a dry-run, which should appropriately stop and start the Apache server, without you having to tell it to do so every time:

certbot renew --dry-run

May I ask why you would like to do this?

I think in general we would either advise that you either:

  1. Use the Certificate symlinks directly. That is, C:\Certbot\live\example.com\fullchain.pem and C:\Certbot\live\example.com\privkey.pem. They will be automatically updated at renewal.
  2. Get Certbot to create a copy of the certificate and private key files, by using a --deploy-hook script that wil copy it to the appropriate location. I can help you write one for Windows, if you're interested.

I am not really srue what will happen when modifying the paths in the renewal conf file. It's definitely off the beaten path and I wouldn't be surprised if it causes problems.

1 Like