Multi domain single Caddy Server


(Jc) #1

Hi all,

I just compiled my first caddy server from source and I’m loving it. I have an ssl question that I wasn’t able to resolve searching this forum.

Caddyfile:

Domain1.com, domain2.dev {
tls email@adress
}

Domain.com uses the default email ssl
Domain.dev has a digicert ssl

Can I add the digicert to the.dev domain? If there is an example I could learn from this is a total newb question.

Thanks in advance


(Matthew Fay) #2

Hi @Crook, welcome to the Caddy community!

The tls directive applies to the entire site, so you’d have to open a separate site definition.

example.com {
  tls email@example.com
}

example.net {
  tls [cert] [key]
}

If you’ve got additional configuration you want to share between the two, you could either copy+paste it between them, or use snippets:

https://caddyserver.com/docs/caddyfile#snippets
https://caddyserver.com/docs/tls


(Sugarcube) #3

@Whitestrake thanks for mentioning snippets, very useful feature !


(Jc) #4

Thanks @Whitestrake I appreciate the support and welcoming!