$ sudo add-apt-repository ppa:certbot/certbot
$ sudo apt-get update
$ sudo apt-get install python-certbot-apache
$ sudo apt-get install certbot python3-certbot-dns-digitalocean
Obtain your DO API token, save to ~/.secrets/certbot/digitalocean.ini, eg
# DigitalOcean API credentials used by Certbot dns_digitalocean_token = 0000111122223333444455556666777788889999aaaabbbbccccddddeeeeffff
certbot certonly \ --dns-digitalocean \ --dns-digitalocean-credentials ~/.secrets/certbot/digitalocean.ini \ -d example.com -d *.example.com
Your certs will be saved to /etc/letsencrypt/live/example.com/
We will be replaceing this later, but the autoconfigure works well to configure Apache correctly
$ sudo certbot --apache -d example.com
Your certs will be saved to /etc/letsencrypt/live/example.com-0001/
You may need to symlink ssl.load and ssl.conf, into you /etc/apache2/mods-enabled/ folder
Open /etc/apache2/sites-available/000-default-le-ssl.conf, modify the path to SSLCertificateFile and SSLCertificateKeyFile. These should point to your wildcard certs /etc/letsencrypt/live/example.com/
You can confirm which certs are your wildcard bby running:
$ certbot certificates
You might also try deleting the unused cert `sudo certbot delete ...`
Certs expire evey 90 days so you will need to renew them automatically. Add a cronjob, for example every Sunday at 5:30
crontab -e
3 5 * * 0 /usr/bin/certbot renew --quiet && /usr/sbin/service apache2 restart