Skip to content

Instantly share code, notes, and snippets.

@mrroot5
Created January 20, 2022 11:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrroot5/02b8bc9fa0d1662bbbd90d291bbde5a1 to your computer and use it in GitHub Desktop.
Save mrroot5/02b8bc9fa0d1662bbbd90d291bbde5a1 to your computer and use it in GitHub Desktop.
Install Letsencrypt cert. into a debian/ubuntu. Keywords: letsencrypt, ubuntu, ubuntu letsencrypt

Intro

How to set up letsencrypt on a debian/ubuntu machine. Step by step:

Update and install Certbot

$ apt update
# for apache-using web server
$ apt install certbot python3-certbot-apache
# for nginx-using web server
$ apt install certbot python3-certbot-nginx

Get the certificate

# for apache-using web server
$ certbot --apache -d example.com -d www.ejemplo.com -d ...
# for nginx-using web server
$ certbot --nginx -d example.com -d www.ejemplo.com -d ...

If the certificate is unable to find a vhost with the ServerName specified, we need to choose the one with https protocol.

Copy the certificate

Copy into a backup file the file in /etc/apache2/sites-available/default-ssl.conf and edit it in order to aim at the recently issued certificate files changing the following lines

SSLCertificateFile /etc/letsencrypt/live/server-name/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/server-name/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

With this configuration, the issued certificate should be trusted and on use by now.

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