# SSL Certificate with multiple domains

**URL:** <https://community.traefik.io/t/ssl-certificate-with-multiple-domains/14062>\
**Category:** Traefik v2\
**Tags:** docker\
**Created:** [April 6, 2022, 10:55pm UTC](https://community.traefik.io/t/ssl-certificate-with-multiple-domains/14062 "2022-04-06T22:55:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nek](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/nek/32/5191_2.png) [@Nek](https://community.traefik.io/u/Nek)\
**Post date:** [April 6, 2022, 10:55pm UTC](https://community.traefik.io/t/ssl-certificate-with-multiple-domains/14062/1 "2022-04-06T22:55:11Z")

</div>

Hello,

I'm not sure to understand exactly how traefik works with multiple domains management and SSL certificates. What I'm trying to achieve is exactly the same as [this unanswered StackOverflow post](https://stackoverflow.com/questions/67765119/traefik-dockercompose-multiple-host-in-label-let-is-serve-different-ssl-cert).

I have configured a certificate resolver:

```auto
# traefik.toml file
[certificatesResolvers.nekland.acme]
  email = "some@nekland.fr"
  storage = "/letsencrypt/acme.json"

  [certificatesResolvers.nekland.acme.tlsChallenge]

```

And I have a docker with the following configuration:

```yaml
services:
  nginx:
    image: nginx:1.21
    restart: always
    volumes:
      - ./conf.d:/etc/nginx/conf.d
      - /infrastructure/webapps:/webapps
    networks:
      - traefik
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nginx.entryPoints=websecure"
      - "traefik.http.routers.nginx.rule=HostRegexp(`nekland.fr`, `{subdomain:.*}.nekland.fr`, `ea-invest-conseil.fr`, `{subdomain:.*}.ea-invest-conseil.fr`)"
      - "traefik.http.routers.nginx.priority=1"
      - "traefik.http.routers.nginx.tls=true"
      - "traefik.http.routers.nginx.tls.certResolver=nekland"

```

On [nekland.fr](http://nekland.fr) I have a valid while the situation is more complicated on [ea-invest-conseil.fr](http://ea-invest-conseil.fr). I have no idea why it works on the first and fails on the second. But also this configuration seems to be "too simple" to be real (even though traefik is designed for simple configurations).

Is there a good solution to make this work ?

Thanks!

---

<div class="post-metadata">

**Author:** ![bluepuma77](https://avatars.discourse-cdn.com/v4/letter/b/a9adbd/32.png) [@bluepuma77](https://community.traefik.io/u/bluepuma77)\
**Post date:** [January 11, 2023, 10:46am UTC](https://community.traefik.io/t/ssl-certificate-with-multiple-domains/14062/2 "2023-01-11T10:46:54Z")

</div>

You can get a LetsEncrypt cert with multiple domains, just use label `.rule=Host()||Host()`.

For real wildcard certificates (\*.example.com) you need to use [dnsChallenge](https://doc.traefik.io/traefik/https/acme/#dnschallenge).
