Traefik + Nextcloud导致糟糕的网关

时间:2018-05-16 05:14:14

标签: docker docker-compose traefik nextcloud

我有3个服务正在运行。 一个mariadb& nextcloud实例:

version: '2.1'

volumes:
  nextcloud:
  db:

services:
  db:
    image: mariadb
    volumes:
      - db:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=my_root_password
      - MYSQL_PASSWORD=my_password
      - MYSQL_DATABASE=my_database
      - MYSQL_USER=my_user
  app:
    image: nextcloud
    restart: always
    networks:
      - web
      - default
    ports:
      - 9000
    labels:
      - "traefik.backend=app"
      - "traefik.docker.network=web"
      - "traefik.frontend.rule=Host:my_host"
      - "traefik.enable=true"
      - "traefik.port=9000"
      - "traefik.default.protocol=http"

networks:
  web:
    external: true

和traefik服务:

version: '2'

services:
  traefik:
    image: traefik:1.5.4
    restart: always
    ports:
      - 80:80
      - 443:443
    networks:
      - web
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /opt/traefik/traefik.toml:/traefik.toml
      - /opt/traefik/acme.json:/acme.json
    container_name: traefik

networks:
  web:
    external: true

此traefik实例正在使用此配置文件:

debug = false

logLevel = "ERROR"
defaultEntryPoints = ["https","http"]

[entryPoints]
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  [entryPoints.https]
  address = ":443"
  [entryPoints.https.tls]

[retry]

[docker]
endpoint = "unix:///var/run/docker.sock"
domain = "my_host"
watch = true
exposedByDefault = false

[acme]
email = "my_email"
storage = "acme.json"
entryPoint = "https"
onHostRule = true
[acme.httpChallenge]
entryPoint = "http"

现在,当我转到我的主机时,它会重定向到HTTPS,但它只显示bad gateway而没有其他内容。它应该显示nextcloud Web应用程序。任何人都知道为什么会这样吗?我正在使用docker-compose up -d命令运行撰写文件。

1 个答案:

答案 0 :(得分:0)

现在可能为时已晚,但我本人也遇到了此问题,因此请发布答案以解决该问题。
Nextcloud公开了Traefik尝试连接的容器IP地址上的端口80。因此,您错误地为“ traefik.port”标签指定了端口。将其从9000更改为80。