linux - caddy - 设置多种子域名 set multiple level subdomains ssl certificates

访问量: 639

这里有个最新的:
https://caddy.community/t/how-to-use-ssl-for-multiple-subdomains/17231

refer to: https://stackoverflow.com/questions/70860752/generic-domain-part-with-fixed-subdomain-using-caddy-and-auto-ssl/73760155#73760155

https://caddy.community/t/rejecting-multi-level-subdomains/11475

I met the same problem, and after 1 day's stucking, here is my solution:

Assuming the site name is: site.com, and I want caddy handle these domains for me:

  • a.dot.site.com

  • b.dot.site.com

  • c.dot.site.com

  • a.eth.site.com

  • b.eth.site.com

  • c.eth.site.com

1.make sure you set SSL access available. e.g. via cloudflare:

enter image description here

2.set the A address pointing to your Caddy server's IP.

enter image description here

2.Caddy file should looks like:

# the key is: you have to list all the patterns for your multiple subdomains
*.site.com *.eth.site.com *.dot.site.com {
  reverse_proxy 127.0.0.1:4567

  log {
    output file /var/log/access-wildcard-site.com.log
  }

  tls {
    dns cloudflare <your cloud flare api key>
  }

}


订阅/RSS Feed

Subscribe