Bad gatway on phpmyadmin with Traefik V2

Hi,

I tried several things but I can't get it working yet. All I see is a page with "bad gateway" on sql.xxxxxx.com but wordpress works nicely on xxxxxx.com. Any idea?

The blog docker-compose.yml:

version: '3'

networks:
  # enable connection with Traefik
  traefik:
    external: true
  # network for the app
  backend:

services:

  wordpress:
    build:
      # call the Dockerfile in ./wordpress
      context: ./wordpress
    restart: always
    environment:
      # Connect WordPrerss to the database
      WORDPRESS_DB_HOST: db:3306
      WORDPRESS_DB_USER: xxxxxx
      WORDPRESS_DB_PASSWORD: xxxxxx
      WORDPRESS_DB_NAME: xxxxxx
    volumes:
      # save the content of WordPress an enable local modifications
      - ./wordpress/data:/var/www/html
    networks:
      - traefik
      - backend
    depends_on:
        - db
        - redis
    labels:
      # The labels are usefull for Traefik only
      - "traefik.enable=true"
      - "traefik.docker.network=traefik"
      # Get the routes from http
      - "traefik.http.routers.wordpresscp.rule=Host(`xxxxxx.com`)"
      - "traefik.http.routers.wordpresscp.entrypoints=web"
      # Redirect these routes to https
      - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
      - "traefik.http.routers.wordpresscp.middlewares=redirect-to-https@docker"
      # Get the routes from https
      - "traefik.http.routers.wordpresscp-secured.rule=Host(`xxxxxx.com`)"
      - "traefik.http.routers.wordpresscp-secured.entrypoints=web-secure"
      # Apply autentificiation with http challenge
      - "traefik.http.routers.wordpresscp-secured.tls=true"
      - "traefik.http.routers.wordpresscp-secured.tls.certresolver=myhttpchallenge"

  db:
    # this is the database used by Wordpress
    image: mysql:5.7
    restart: always
    environment:
      # Connect WordPrerss to the database
      MYSQL_DATABASE: xxxxxx
      MYSQL_USER: xxxxxx
      MYSQL_PASSWORD: xxxxxx
      MYSQL_RANDOM_ROOT_PASSWORD: '1'
    volumes:
      # dirty hack to save the database
      - ./db:/var/lib/mysql
    networks:
      - backend


  redis:
    image: redis:6
    restart: always
    ports:
      - "6379:6379"
    networks:
      - backend
    entrypoint: redis-server --maxmemory 512mb -maxmemory-policy allkeys-lru
    
    
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    networks:
      - backend
      - traefik
    depends_on:
      - db
    environment:
      - PMA_ARBITRARY=1
      - PMA_HOST=db
      - PMA_PORT=3306
      - PMA_USER=xxxxxx
      - PMA_PASSWORD=xxxxxx
      - PMA_ABSOLUTE_URI=https://sql.xxxxxx.com
      - MYSQL_ROOT_PASSWORD=xxxxxx
    restart: always
    volumes:
     - /sessions
    labels:
      # The labels are usefull for Traefik only
      - "traefik.enable=true"
      - "traefik.docker.network=traefik"
      # Get the data from port xxxx instead of port 80
      - "traefik.http.services.phpmyadmincp.loadbalancer.server.port=8080"
      # Get the routes from http
      - "traefik.http.routers.phpmyadmincp.rule=Host(`sql.xxxxxxh.com`)"
      - "traefik.http.routers.phpmyadmincp.entrypoints=web"
      # Redirect these routes to https
      - "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
      - "traefik.http.routers.phpmyadmincp.middlewares=redirect-to-https@docker"
      # Get the routes from https
      - "traefik.http.routers.phpmyadmincp-secured.rule=Host(`sql.xxxxxx.com`)"
      - "traefik.http.routers.phpmyadmincp-secured.entrypoints=web-secure"
      # Apply autentificiation with http challenge
      - "traefik.http.routers.phpmyadmincp-secured.tls=true"
      - "traefik.http.routers.phpmyadmincp-secured.tls.certresolver=myhttpchallenge"

The docker-compose.yml file of Traefik:

version: "3.3"

networks:
    # Allow the use of traefik in other docker-compose.yml files
    traefik:
        external: true

services:

  traefik:
    image: "traefik:v2.2"
    container_name: "traefik"
    env_file:
      - ./.env
    command:
      # Only for development environment
      - "--log.level=DEBUG"
      - "--api.insecure=true"
      # Get Docker as the provider
      - "--providers.docker=true"
      # Avoid that all containers are exposed
      - "--providers.docker.exposedbydefault=false"
      # Settle the ports for the entry points
      - "--entrypoints.web.address=:80"
      - "--entrypoints.web-secure.address=:443"
      # Settle the autentification method to http challenge
      - "--certificatesresolvers.myhttpchallenge.acme.httpchallenge=true"
      - "--certificatesresolvers.myhttpchallenge.acme.httpchallenge.entrypoint=web"
      # Uncomment this to get a fake certificate when testing
      #- "--certificatesresolvers.myhttpchallenge.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
      # Settle letsencrypt as the certificate provider
      - "--certificatesresolvers.myhttpchallenge.acme.email=${USER_MAIL}"
      - "--certificatesresolvers.myhttpchallenge.acme.storage=/letsencrypt/acme.json"
    ports:
      - "80:80"
      - "443:443"
      - "8080:8080"
    networks:
      - "traefik"
    volumes:
      # Store certificates in ./letsencrypt/acme.json
      - "./letsencrypt:/letsencrypt"
      # Connect to Doker socket
      - "/var/run/docker.sock:/var/run/docker.sock:ro"

Thanks

Ok, this was linked to PhpMyAdmin, I don't know why I assumed it ran on port 8080, it is actually 80.

remove this line:

- "traefik.http.services.phpmyadmincp.loadbalancer.server.port=8080"