Traefik SSL代理返回404

时间:2018-12-09 14:01:22

标签: ssl traefik

我想使用Traefik作为swarm内部的反向代理,并将SSL流量传递到特定的容器(wordpress:latest)。 SSL证书似乎可以正常工作,但是我在https://fakepage.com上未找到 404页面(我正在使用占位符域,以避免公开私人信息)。

通过http的交通正常运行。

我正在使用的docker堆栈的docker-compose配置。

version: "3.6"
services:
  traefik:
    image: traefik
    ports:
      - 80:80
      - 443:443
      - 8080:8080
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      placement:
        constraints: [node.role == worker]
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - traefik_data:/tmp
    command:
      - "--docker"
      - "--docker.domain=fakepage.com"
      - "--logLevel=DEBUG"
      - "--api"
      - "--api.statistics"
      - "--entryPoints=Name:http Address::80"
      - "--entryPoints=Name:https Address::443 TLS"
      - "--docker.endpoint=unix:///var/run/docker.sock"
      - "--acme=true"
      - "--acme.entrypoint=https"
      - "--acme.httpchallenge"
      - "--acme.httpchallenge.entrypoint=http"
      - "--acme.domains=fakepage.com"
      - "--acme.email=admin@fakepage.com" 
      - "--acme.storage=/tmp/acme.json"
  db:
    image: "mysql:5.7"
    environment:
      MYSQL_ROOT_PASSWORD: example
      MYSQL_USER: wordpress
      MYSQL_PASSWORD: wordpress
      MYSQL_DATABASE: wordpress
    deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      placement:
        constraints: [node.role == worker]
    volumes:
      - db_data:/var/lib/mysql
  wordpress:
     depends_on:
       - db
     image: wordpress:latest
     deploy:
      replicas: 1
      restart_policy:
        condition: on-failure
        delay: 5s
        max_attempts: 3
        window: 120s
      placement:
        constraints: [node.role == worker]
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
     volumes:
       - wp_data:/var/www/html
     labels:
      traefik.enable: "true"
      traefik.frontend.rule: "Host:fakepage.com"

volumes:
  db_data:
  wp_data:
  traefik_data:

1 个答案:

答案 0 :(得分:0)

问题是我在容器下缺少分段标志。

traefik.frontend.entryPoints: "http,https"