Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
renew ssl letsencrypt certificate on bitnami server
#!/bin/bash
#renew ssl letsencrypt certificate on bitnami server
#https://gist.github.com/printminion/6ec2fc0fefaba8e0a98a63a6d73b0802/edit
sudo /opt/bitnami/ctlscript.sh stop apache
cd /home/user/certbot
#./certbot-auto certonly --standalone -w /opt/bitnami/apache2/conf/ -d example
.com -d www.example.com
./certbot-auto renew
sudo cp /etc/letsencrypt/live/example.com/fullchain.pem /opt/bitnami/apache2/conf/server.crt
sudo cp /etc/letsencrypt/live/example.com/privkey.pem /opt/bitnami/apache2/conf/server.key
sudo /opt/bitnami/ctlscript.sh start apache
@dhimmel

This comment has been minimized.

Copy link

commented Feb 6, 2017

Cool. I created a similar script for renewing my Let's Encrypt SSL certificate on a Bitnami Piwik image. Thanks for the inspiration.

# Renew Let's Encrypt SSL Certificates
# https://docs.bitnami.com/google/components/apache/#how-to-install-the-lets-encrypt-client

# Schedule with crontab -e `0 4 1,16 * *  sh /home/bitnami/ssl/renew.sh >> /home/bitnami/ssl/cron-renew.log`

# print a separator line
printf '%79s\n' | tr ' ' '#'

# output date
date --iso-8601=seconds --universal

# Stop webserver
sudo /opt/bitnami/ctlscript.sh stop apache

# Renew certificates
cd /home/bitnami/ssl/letsencrypt
sudo ./letsencrypt-auto renew
sudo cp /etc/letsencrypt/live/piwik.dhimmel.com/cert.pem /opt/bitnami/apache2/conf/server.crt
sudo cp /etc/letsencrypt/live/piwik.dhimmel.com/privkey.pem /opt/bitnami/apache2/conf/server.key

# Start webserver
sudo /opt/bitnami/ctlscript.sh start apache
@technicalogical

This comment has been minimized.

Copy link

commented Mar 9, 2017

Thanks for the scripts guys. I piggybacked off of dhimmel's script, but needed to change:

sudo cp /etc/letsencrypt/live/DOMAIN/cert.pem /opt/bitnami/apache2/conf/server.crt

to

sudo cp /etc/letsencrypt/live/DOMAIN/fullchain.pem /opt/bitnami/apache2/conf/server.crt

Without the change, things worked, but the cert chain was incomplete and very possibly was not resolving in some browsers.

@Rohit-064

This comment has been minimized.

Copy link

commented Nov 9, 2017

Where should i add this file ?? i mean in which folder ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.