Install LetsEncrypt SSL on Bitnami

NOTE: bitnami provides a tool to install SSL, it is better to use the tool to install SSL. You can see more info on page How to install LetsEncrypt SSL on Bitnami WordPress Server

To install LetsEncrypt SSL on bitnami wordpress server, install letsencrypt with

wget https://raw.githubusercontent.com/serverok/server-setup/master/install/letsencrypt.sh
sh ./letsencrypt.sh

Stop apache web server with

/opt/bitnami/ctlscript.sh stop apache

Now get SSL certificate using certbot

certbot certonly --standalone -d YOUR-DOMAIN.EXT -d www.YOUR-DOMAIN.EXT

Now you have SSL certficate, lets copy it to bitnami folder

cat /etc/letsencrypt/live/YOUR-DOMAIN.EXT/privkey.pem >  /opt/bitnami/apache2/conf/server.key
cat /etc/letsencrypt/live/YOUR-DOMAIN.EXT/cert.pem > /opt/bitnami/apache2/conf/server.crt
cat /etc/letsencrypt/live/YOUR-DOMAIN.EXT/chain.pem >> /opt/bitnami/apache2/conf/server.crt

Start the web server with

/opt/bitnami/ctlscript.sh start apache

Auto Renew LetsEncrypt

Create file

mkdir /usr/serverok
vi /usr/serverok/ssl-renew

Add following to the file. Replace YOUR-DOMAIN.EXT with your actual domain name.

#!/bin/bash

/opt/bitnami/ctlscript.sh stop apache
/usr/bin/certbot renew
cat /etc/letsencrypt/live/YOUR-DOMAIN.EXT/privkey.pem >  /opt/bitnami/apache2/conf/server.key
cat /etc/letsencrypt/live/YOUR-DOMAIN.EXT/cert.pem > /opt/bitnami/apache2/conf/server.crt
cat /etc/letsencrypt/live/YOUR-DOMAIN.EXT/chain.pem >> /opt/bitnami/apache2/conf/server.crt
sleep 20
/opt/bitnami/ctlscript.sh restart apache

make the script executable

chmod 755 /usr/serverok/ssl-renew

Set a cronjob to execute it every month

30 2 * * 1 /usr/serverok/ssl-renew >> /var/log/le-renew.log

See bitnami

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *