# How to specify certResolver

**URL:** <https://community.traefik.io/t/how-to-specify-certresolver/3122>\
**Category:** Traefik v2\
**Tags:** letsencrypt-acme, docker\
**Created:** [November 25, 2019, 2:02am UTC](https://community.traefik.io/t/how-to-specify-certresolver/3122 "2019-11-25T02:02:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![owenfi](https://avatars.discourse-cdn.com/v4/letter/o/eada6e/32.png) [@owenfi](https://community.traefik.io/u/owenfi)\
**Post date:** [November 25, 2019, 2:02am UTC](https://community.traefik.io/t/how-to-specify-certresolver/3122/1 "2019-11-25T02:02:58Z")

</div>

I'm stuck getting my Traefik instance to generate certs (or redirect to HTTPS, but one thing at a time) when viewing view HTTPS.

Here is my attempted config that I believe should be working:

traefik.yml:

```
entryPoints:
web:
    address: ":80"

  web-secure:
    address: ":443"

  other:
    address: ":9090"

  certificatesResolvers:
    sample:
      acme:
        email: acme@owenimholte.com
        storage: acme.json
        httpChallenge:
        entryPoint: web

http:
  routers:
    engager:
      rule: "Host(`sunkenlighthouse.com`)"
      service: "nginx"
      tls:
          certResolver: sample
     entryPoints:
        - "web-secure"

```

docker-compose.yml:

```
nginx:
    image: nginx:latest
    volumes:
      - /Sites/sunkenlighthouse.com:/usr/share/nginx/html
    labels:
      - "traefik.enable=true"

```

One point I'm not clear about is in the instructions it says to "specify" the certResolver for a given router. This makes sense but the naming is unclear, in the above example would it be "sample" or am I missing the concept? If that were spelled out a bit more in the docs it would be appreciated.

---

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [November 25, 2019, 8:55am UTC](https://community.traefik.io/t/how-to-specify-certresolver/3122/2 "2019-11-25T08:55:07Z")

</div>

Hello,

traefik.yml

```auto
entryPoints:
  web:
    address: ":80"

  web-secure:
    address: ":443"

  other:
    address: ":9090"

providers:
  docker:
    exposedByDefault: false

certificatesResolvers:
  sample:
    acme:
      email: acme@owenimholte.com
      storage: acme.json
      httpChallenge:
      entryPoint: web

```

docker-compose.yml:

```auto
nginx:
    image: nginx:latest
    volumes:
      - /Sites/sunkenlighthouse.com:/usr/share/nginx/html
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.nginx.rule=Host(`sunkenlighthouse.com`)"
      - "traefik.http.routers.nginx.tls.certResolver=sample"
      - "traefik.http.routers.nginx.entryPoints=web-secure"

```

---

<div class="post-metadata">

**Author:** ![owenfi](https://avatars.discourse-cdn.com/v4/letter/o/eada6e/32.png) [@owenfi](https://community.traefik.io/u/owenfi)\
**Post date:** [November 25, 2019, 9:23am UTC](https://community.traefik.io/t/how-to-specify-certresolver/3122/3 "2019-11-25T09:23:49Z")

</div>

Thanks very much! Tiny edit, the 2nd label should read `...rule=Host...` of course. Thanks!

This has successfully enabled my SSL, I think I can make progress from here. Woohoo!

If I preferred this Nginx biz to be in the Traefik.yml (or another "dynamic" config?), it seems like that should be possible, no?

Not sure why I had so much trouble but one other issue I was having was mapping in an old config file from my previous attempt to get everything working's directory. Cleaning it all up based on your suggestion did the trick. Thanks again!

---

<div class="post-metadata">

**Author:** ![owenfi](https://avatars.discourse-cdn.com/v4/letter/o/eada6e/32.png) [@owenfi](https://community.traefik.io/u/owenfi)\
**Post date:** [November 25, 2019, 10:24am UTC](https://community.traefik.io/t/how-to-specify-certresolver/3122/4 "2019-11-25T10:24:08Z")

</div>

I feel I'm very close but for some reason not able to figure out what the docker service-id/name would be. The obvious answer in this case would be `nginx` but the server only 404's with the following config:

 ![32%20AM](https://us1.discourse-cdn.com/flex020/uploads/containo/original/2X/b/bfde52eb00f7155a52e8ce50abb05e3cba4a10ad.png)

---

<div class="post-metadata">

**Author:** ![ldez](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/ldez/32/5_2.png) [@ldez](https://community.traefik.io/u/ldez)\
**Post date:** [November 25, 2019, 11:58am UTC](https://community.traefik.io/t/how-to-specify-certresolver/3122/5 "2019-11-25T11:58:28Z")

</div>

I recommend to use labels instead of file to define routers on container.

Also the file traefik.yml contains the static configuration, so the dynamic configuration must be define in another file and require to enable the file provider.
