Skip to content

Instantly share code, notes, and snippets.

@touren
Last active May 8, 2018 02:43
Show Gist options
  • Save touren/6d7d517d5cdd5ba3baf31d6aeb89ab66 to your computer and use it in GitHub Desktop.
Save touren/6d7d517d5cdd5ba3baf31d6aeb89ab66 to your computer and use it in GitHub Desktop.
Renew Bitnami WordPress server's certifications using cerbot.
#!/bin/bash
## Install cerbot, which can automatically generate, renew and deploying Let's Encrypt certificates.
sudo apt-get update
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install certbot
## NOTE: Before proceeding with this step, ensure that your domain name points to the public IP address of the Bitnami application host.
## certbot (webroot plugin) will generate new certificates in folder: /etc/letsencrypt/live/example.com/
## you need to copy these 2 files (cert & private) to /home/bitnami/stack/apache2/conf/
## and restart service bitnami
sudo certbot certonly --webroot -w /home/bitnami/apps/wordpress/htdocs -d example.com -d www.example.com
sudo mv /home/bitnami/stack/apache2/conf/server.crt /home/bitnami/stack/apache2/conf/server.crt.`date +%Y%m%d`
sudo cp /etc/letsencrypt/live/example.com/fullchain.pem /home/bitnami/stack/apache2/conf/server.crt
sudo mv /home/bitnami/stack/apache2/conf/server.key /home/bitnami/stack/apache2/conf/server.key.`date +%Y%m%d`
sudo cp /etc/letsencrypt/live/example.com/privkey.pem /home/bitnami/stack/apache2/conf/server.key
sudo service bitnami restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment