Setting up a Free SSL LetsEncrypt Certificate for Lightsail and renewing/updating

  • Posted on Tuesday, February 27, 2018

Hello everyone in this quick tutorial we wanted to take you through how to setup a free ssl certificate with LetsEncrypt.

First please follow our Lightsail tutorial here https://www.youtube.com/watch?v=TZLfG7T2tx4.

Step One: SSH into your instance and run.

sudo su
cd ~
mkdir tmp

Step Two: Install Letsencrypt

wget https://dl.eff.org/certbot-auto
chmod a+x certbot-auto

Step Three: Run the script

./certbot-auto certonly --webroot -w /home/bitnami/htdocs/ -d example.com

Step Four: Delete two files to be replaced by the newly created ones

cd /opt/bitnami/apache2/conf/
rm server.crt
rm server.key

Step Five: Create links for the newly created files

sudo ln -s /etc/letsencrypt/live/example.com/fullchain.pem /opt/bitnami/apache2/conf/server.crt
sudo ln -s /etc/letsencrypt/live/example.com/privkey.pem /opt/bitnami/apache2/conf/server.key

Now very important restart Apache

sudo /opt/bitnami/ctlscript.sh apache restart

!Important to renew simply run in your tmp folder.

./certbot-auto renew

To force renew your LetsEncrypt Certificate run

./certbot-auto renew --force-renew

Extra if you would like to force https

sudo vim /opt/bitnami/apache2/conf/bitnami/bitnami.conf

Add the text below here:

< VirtualHostĀ default:80 >
DocumentRoot "/opt/bitnami/apache2/htdocs"

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [R,L]

Now very important restart Apache

sudo /opt/bitnami/ctlscript.sh apache restart

Remove banner

sudo /opt/bitnami/apps/wordpress/bnconfig --disable_banner 1

Over 4 million videos delivered every month
via Amazon Web Services!

Scalable Media Delivery

Start 10 day free trial