4

I'm evaluating the possibility of changing my main webserver from nginx to caddy 2.
Is there any way to use existing letsencrypt certificates managed by certbot in caddy 2?

fimdomeio
  • 71
  • 1
  • 6

2 Answers2

5

You can. You need to have the following line in your Caddyfile. You have to obtain cert.pem and key.pem files and place them in same directory as Caddyfile.

tls cert.pem key.pem

You can refer this official documentation here. https://caddyserver.com/docs/v2-upgrade#tls

navule
  • 3,212
  • 2
  • 36
  • 54
0

To use Let's Encrypt certificates in Caddy, add the following lines to your Caddyfile:

tls /etc/letsencrypt/live/example.com/fullchain.pem /etc/letsencrypt/live/example.com/privkey.pem {
  trusted_ca_cert_path /etc/letsencrypt/live/example.com/chain.pem
}

For Nginx, use the following configuration:

ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;

For Apache, use the following configuration:

SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/example.com/chain.pem

Replace example.com with your domain or subdomain name.

Madan Sapkota
  • 25,047
  • 11
  • 113
  • 117