I'm trying to figure out how I can renew my certificates without any downtime to my Apache2 server and its client connections.
I use root's Crontab, configured with:
0 */4 * * * /root/letsencrypt-auto.sh
the /root/letsencrypt-auto.sh file contains:
#!/bin/bash
date >> /root/logs/letsencrypt.log
letsencrypt renew >> /root/logs/letsencrypt.log
and here is what my log file is spammed with:
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/imaginecrafting.com/fullchain.pem (failure)
/etc/letsencrypt/live/www.imaginecrafting.com/fullchain.pem (failure)
/etc/letsencrypt/live/mail.imaginecrafting.com/fullchain.pem (failure)
Thu Feb 15 16:00:01 UTC 2018
Processing /etc/letsencrypt/renewal/imaginecrafting.com.conf
-------------------------------------------------------------------------------
The program apache2 (process ID 2699) is already listening on TCP port 80. This
will prevent us from binding to that port. Please stop the apache2 program
temporarily and then try again. For automated renewal, you may want to use a
script that stops and starts your webserver. You can find an example at
https://letsencrypt.org/howitworks/#writing-your-own-renewal-script.
Alternatively you can use the webroot plugin to renew without needing to stop
and start your webserver.
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/www.imaginecrafting.com.conf
-------------------------------------------------------------------------------
The program apache2 (process ID 2699) is already listening on TCP port 80. This
will prevent us from binding to that port. Please stop the apache2 program
temporarily and then try again. For automated renewal, you may want to use a
script that stops and starts your webserver. You can find an example at
https://letsencrypt.org/howitworks/#writing-your-own-renewal-script.
Alternatively you can use the webroot plugin to renew without needing to stop
and start your webserver.
-------------------------------------------------------------------------------
Processing /etc/letsencrypt/renewal/mail.imaginecrafting.com.conf
-------------------------------------------------------------------------------
The program apache2 (process ID 2699) is already listening on TCP port 80. This
will prevent us from binding to that port. Please stop the apache2 program
temporarily and then try again. For automated renewal, you may want to use a
script that stops and starts your webserver. You can find an example at
https://letsencrypt.org/howitworks/#writing-your-own-renewal-script.
Alternatively you can use the webroot plugin to renew without needing to stop
and start your webserver.
-------------------------------------------------------------------------------
All renewal attempts failed. The following certs could not be renewed:
/etc/letsencrypt/live/imaginecrafting.com/fullchain.pem (failure)
/etc/letsencrypt/live/www.imaginecrafting.com/fullchain.pem (failure)
/etc/letsencrypt/live/mail.imaginecrafting.com/fullchain.pem (failure)
I don't want to shut down my Apache2 server to renew certs. Is there any way I can configure traffic to route my Apache2 server, except if the traffic is from Letsencrypt verification process?
If so, what are the commands for such a thing?
I am using Ubuntu Server 16.04, hosted by DigitalOcean (so I don't have routing/switching capability, but I can do it all in a virtual machine).