fimdomeio
fimdomeio

Reputation: 71

Use existing let's encrypt certificates in caddy 2

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?

Upvotes: 4

Views: 7289

Answers (2)

Madan Sapkota
Madan Sapkota

Reputation: 26101

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.

Upvotes: 1

navule
navule

Reputation: 3644

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

Upvotes: 5

Related Questions