Skip to content

Instantly share code, notes, and snippets.

@dthphuong
Last active December 20, 2022 21:53
Show Gist options
  • Save dthphuong/2fd4f16733cc31a8d67cdc7ede05719a to your computer and use it in GitHub Desktop.
Save dthphuong/2fd4f16733cc31a8d67cdc7ede05719a to your computer and use it in GitHub Desktop.
Setup SSL with Let's Encrypt on Ubuntu 18.04

Step 1 — Installing Certbot

sudo add-apt-repository ppa:certbot/certbot
sudo add-apt-repository universe
sudo apt update
sudo apt install certbot python3-certbot-apache

Step 2 — Set Up the SSL Certificate

sudo nano /etc/apache2/sites-available/your_domain.conf

File: /etc/apache2/sites-available/your_domain.conf

...
ServerName your_domain;
...

Step 3 — Allowing HTTPS Through the Firewall

sudo ufw allow 'Apache Full'
sudo ufw delete allow 'Apache'

Step 4 — Obtaining an SSL Certificate

sudo certbot --apache -d your_domain -d www.your_domain

Step 5 — Verifying Certbot Auto-Renewal

To check the status of this service and make sure it’s active and running, you can use:

sudo systemctl status certbot.timer

To test the renewal process, you can do a dry run with certbot:

sudo certbot renew --dry-run

Ref: https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-18-04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment