How to enable HTTPS with acme-client

mnlwldr

manuel

Posted on October 14, 2018

How to enable HTTPS with acme-client

Populate /etc/acme-client.conf and replace example.com with your domain

authority letsencrypt {
  api url "https://acme-v01.api.letsencrypt.org/directory"
  account key "/etc/acme/letsencrypt-privkey.pem"
}
authority letsencrypt-staging {
  api url "https://acme-staging.api.letsencrypt.org/directory"
  account key "/etc/acme/letsencrypt-staging-privkey.pem"
}
domain example.com {
  alternative names { example.com }
  domain key "/etc/ssl/private/example.com.key"
  domain certificate "/etc/ssl/example.com.crt"
  domain full chain certificate "/etc/ssl/example.com.pem"
  sign with letsencrypt
}

Enter fullscreen mode Exit fullscreen mode

Create directories

mkdir -p -m 700 /etc/acme
mkdir -p -m 700 /etc/ssl/acme/private
mkdir -p -m 755 /var/www/acme
Enter fullscreen mode Exit fullscreen mode

Populate /etc/httpd.conf

server "example.com" {
  listen on * port 80
  root "/htdocs/example.com"
  location "/.well-known/acme-challenge/*" {
    root { "/acme", strip 2 }
  }
}

Enter fullscreen mode Exit fullscreen mode

Check the configuration and restart httpd

httpd -n
Enter fullscreen mode Exit fullscreen mode

When everything looks ok, restart httpd

rcctl restart httpd
Enter fullscreen mode Exit fullscreen mode

Run the acme-client

acme-client -vAD example.com

Enter fullscreen mode Exit fullscreen mode

Now enable HTTPS and restart httpd

Populate /etc/httpd.conf and add a new server section for HTTPS

server "example.com" {
  listen on * tls port 443
  root "/htdocs/example.com"
  tls {
    certificate "/etc/ssl/example.com.pem"
    key "/etc/ssl/private/example.com.key"
  }
  location "/.well-known/acme-challenge/*" {
    root { "/acme", strip 2 }
  }
}

Enter fullscreen mode Exit fullscreen mode

Check the configuration and restart httpd

httpd -n
Enter fullscreen mode Exit fullscreen mode

and

rcctl restart httpd
Enter fullscreen mode Exit fullscreen mode

Now you should reach your website over HTTPS

💖 💪 🙅 🚩
mnlwldr
manuel

Posted on October 14, 2018

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

How to enable HTTPS with acme-client
openbsd How to enable HTTPS with acme-client

October 14, 2018