Skip to content

Instantly share code, notes, and snippets.

@fguillen
Last active August 3, 2022 22:10
Show Gist options
  • Save fguillen/f6989ae05494cdf550a82c18ccd092f2 to your computer and use it in GitHub Desktop.
Save fguillen/f6989ae05494cdf550a82c18ccd092f2 to your computer and use it in GitHub Desktop.
Create SSL certificate using letsencrypt.org

How to create a ssl certificate using letsencrypt in your mac for your own domain

Install certbot

brew install certbot

Generate the certificate

mv <ToMyWorkingFolder>
certbot certonly --manual --preferred-challenges=dns -d <mydomain.com> --logs-dir . --work-dir . --config-dir .
# Follow the instructions to validate your domain

Install the certificates

In my nginx config what I need are these 2 generated files:

  • ./live/<mydomain.com>/cert/fullchain.pem
  • ./live/<mydomain.com>/cert/privkey.pem

And I have to added them in this nginx config section:

server {
  listen 443 ssl;
  ssl_certificate /etc/ssl/fullchain.pem;
  ssl_certificate_key /etc/ssl/privkey.pem;
  
  [...]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment