Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save doraemonxxx/d70a37148d951704d826c1469d9c1018 to your computer and use it in GitHub Desktop.
Save doraemonxxx/d70a37148d951704d826c1469d9c1018 to your computer and use it in GitHub Desktop.
Setting up LetsEncrypt SSL certificate for Moodle on Ubuntu

Setting up LetsEncrypt SSL certificate for Moodle on Ubuntu

  1. Install certbot

sudo apt install certbot python3-certbot-apache
  1. Enable firewall to allow Apache https and ssh

sudo ufw status
sudo ufw enable
sudo ufw allow 'Apache Full'
sudo ufw allow ssh
sudo ufw app list
sudo ufw status
  1. Change ServerName in /etc/apache2/sites-enabled/000-default.conf to DNS names.

(update other Virtual server configurations if multiple DNS alias are required)

  1. Obtain LetsEncrypt certificate (answer prompts according to requirements)

sudo certbot --apache
  1. Restart Apache2

sudo systemctl stop apache2
sudo systemctl start apache2
  1. Check and set certbot timer

sudo systemctl status certbot.timer
sudo certbot renew --dry-run
sudo systemctl status certbot.timer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment