找不到Traefik和Nginx 404页面

时间:2019-08-31 10:00:36

标签: docker nginx docker-compose reverse-proxy traefik

我想将Traefik与Nginx一起使用时收到404 http错误。

如果仅部署nginx,则可以使用,但是当添加traefik配置时,会收到404。

Traefik配置

    defaultEntryPoints = ["https", "http"]
    [entryPoints]
      [entryPoints.http]
      address = ":80"
        [entryPoints.http.redirect]
         entryPoint = "https"
      [entryPoints.https]
      address = ":443"
        [entryPoints.https.tls]
    [acme]
    email = "info@xxxxxx.com"
    storage = "acme.json"
    acmeLogging = true
    entryPoint = "https"
    OnHostRule = true
    ondemand = false
      [acme.httpChallenge]
      entryPoint = "http"
    [docker]
    endpoint = "unix:///var/run/docker.sock"
    domain = "docker.localhost"
    watch = true
    swarmmode = true
    exposedbydefault = false

Traefik docker-compose

    image: traefik:v1.7.9
    command: --web --docker --docker.domain=docker.localhost --logLevel=DEBUG
    ports:
        - "80:80"
        - "443:443"
        - "8080:8080"
    networks:
        - traefik
    volumes:
        - /var/run/docker.sock:/var/run/docker.sock
        - ./conf.d/traefik.toml:/traefik.toml
        - ./conf.d/acme.json:/acme.json:rw
        - /var/log/traefik:/var/log/traefik

Nginx docker-compose

volumes:
       - /var/run/docker.sock:/var/run/docker.sock
       - ./html:/usr/share/nginx/html
       - ./conf.d/nginx.conf:/etc/nginx/nginx.conf
       - /var/log/nginx:/var/log/nginx
networks:
       - traefik
labels:
       - "traefik.enable=true"
       - "traefik.baclend=nginx"
       - "traefik.frontend.passHostHeader=true"
       - "traefik.frontend.entryPoints=[http,https]"
       - "traefik.frontend.headers.SSLRedirect=true"
       - "traefik.frontend.rule=Host:domaixxxxxx.com"
       - "traefik.port=443"

我愿意接受任何建议 谢谢!

1 个答案:

答案 0 :(得分:1)

您的nginx docker-compose配置中有错字,baclend应该是backend