back home

Setup Let’s Encrypt With Apache on Ubuntu 16.04

May 23, 2017

1. Install Let’s Encrypt

$ apt-get install git
$ git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt

2. Generating a Let’s Encrypt SSL certificate

$ ./letsencrypt-auto --apache -d domain.com -d www.domain.com

3. Forcing SSL

RewriteEngine On 
RewriteCond % 80 
RewriteRule ^(.*)$ https://www.yourubuntuserver.example/$1 [R,L]

4. Automatically renewing Let’s Encrypt certificates

$ crontab -e

Add

15 5 * * 5 /opt/letsencrypt/letsencrypt-auto renew >> /var/log/le-renew.log

Congratulations! Ubuntu 16.04 is now utilizing SSL certificates using Let’s Encrypt completely free of charge.