# Understanding Traefik V2

**URL:** <https://community.traefik.io/t/understanding-traefik-v2/10936>\
**Category:** Traefik v2\
**Tags:** docker-swarm\
**Created:** [June 16, 2021, 2:24pm UTC](https://community.traefik.io/t/understanding-traefik-v2/10936 "2021-06-16T14:24:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasondrane](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@jasondrane](https://community.traefik.io/u/jasondrane)\
**Post date:** [June 16, 2021, 2:24pm UTC](https://community.traefik.io/t/understanding-traefik-v2/10936/1 "2021-06-16T14:24:11Z")

</div>

my traefik dashboard is working as expected but anytime I attempt to place another container into my swarm, traefik gives me a le cert but also a bad gateway instead of default "it works" page in the case of nginx container. I have added my code for the nginx container below. Again the cert is working but i get a "bad gateway" when trying to load nginx. Im sure someone has come across this beofore. I have dug to google/reddit/traefik docs to no avail.

```auto
version: '3.8'

services:
  nginx:
    image: nginx:latest
    networks:
      - traefik-public
    volumes:
       - "~/xxxxxxxx/xxxxxxxx/wp-app:/usr/share/nginx/html:ro"
    deploy:
      mode: replicated
      replicas: 6
      labels:
        traefik.enable: "true"
        traefik.http.services.nginx.loadbalancer.server.port: "8080"
        traefik.http.routers.nginx.rule: "Host(`nginx.xxxxxxxxxxxx.com`)"
        traefik.http.routers.nginx.entrypoints: "websecure"
        traefik.http.routers.nginx.tls.certresolver: "letsencryptresolver"

    command: [nginx-debug, '-g', 'daemon off;']

networks:
  traefik-public:
    external: true

```

---

<div class="post-metadata">

**Author:** ![cakiwi](https://sea2.discourse-cdn.com/flex020/user_avatar/community.traefik.io/cakiwi/32/3205_2.png) [@cakiwi](https://community.traefik.io/u/cakiwi)\
**Post date:** [June 16, 2021, 8:13pm UTC](https://community.traefik.io/t/understanding-traefik-v2/10936/2 "2021-06-16T20:13:37Z")

</div>

I believe nginx container is port 80.

So you need:

```yaml
        traefik.http.services.nginx.loadbalancer.server.port: "80"

```

---

<div class="post-metadata">

**Author:** ![jasondrane](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@jasondrane](https://community.traefik.io/u/jasondrane)\
**Post date:** [June 16, 2021, 8:16pm UTC](https://community.traefik.io/t/understanding-traefik-v2/10936/3 "2021-06-16T20:16:57Z")

</div>

I tried that, originally. but let me give it another shot.  
thanks!
