网关超时504或502

时间:2019-03-24 17:31:46

标签: cloudflare gateway traefik

无法通过具有特定域的HTTPS连接到前端:错误502或错误504(数据库或网络邮件) 我正在使用3个YAML文件: traefik 1个 1用于子域1,1用于子域2

Traefik和域1配置正常,问题出在subdomain2上。 docker-compose中的网络配置在subdomain1和subdomain2之间几乎相同。重新启动和重新创建容器不会更改任何内容。

traefik.yaml
version: '3'

networks:
  internal:
    internal: true
    external: false
  prometheus:
    external:
      name: dockerprometheus_back-tier

services:
  reverse-proxy:
    image: traefik #The official Traefik docker image
    container_name: traefik
    command: --api --docker --docker.domain=domain.local
    ports:
      - "80:80"     #The HTTP port
      - "443:443"   #The HTTPS port
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=Host:mail.prekre.com
      - traefik.port=8080
      - traefik.docker.network=prometheus
    expose:
      - "8090"
    env_file:
      - ./prekre.env
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock #So that Traefik can listen to the Docker events
      - ./traefik2.toml:/traefik.toml
      - ./acme.json:/acme.json
    restart: always

    command: --api --docker --docker.domain=domain.local #Enables the web UI and tells Træfik to listen to docker
#    command: --web --web.metrics.prometheus --web.metrics.prometheus.buckets="0.1,0.3,1.2,5.0" --docker --docker.domain=domain.local --logLevel=DEBUG
    networks:
      - prometheus
    ports:
      - "80:80"     #The HTTP port
      - "443:443"   #The HTTPS port
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=Host:mail.prekre.com
      - traefik.port=8080
      - traefik.docker.network=prometheus
    expose:
      - "8090"
    env_file:
      - ./prekre.env
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock #So that Traefik can listen to the Docker events
      - ./traefik2.toml:/traefik.toml
      - ./acme.json:/acme.json
    restart: always

sub1.yaml

version: '3'

networks:
  onlykoreainternal:
    driver: bridge
    external: false
    internal: true
  prometheus:
    external:
      name: dockerprometheus_back-tier


sub2.yaml
version: '3'

networks:
  mail_network:
    driver: bridge
    external: false
    internal: true
  prometheus:
    external:
      name: dockerprometheus_back-tier

services:
  mailserver:
    image: hardware/mailserver:${MAILSERVER_DOCKER_TAG}
    container_name: mailserver
    restart: ${RESTART_MODE}
    domainname: ${MAILSERVER_DOMAIN}                    # Mail server A/MX/FQDN & reverse PTR = mail.domain.tld.
    hostname: ${MAILSERVER_HOSTNAME}
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=Host:spam.${MAILSERVER_DOMAIN}
      - traefik.port=80
      - traefik.docker.network=prometheus


services:
  mailserver:
    image: hardware/mailserver:${MAILSERVER_DOCKER_TAG}
    container_name: mailserver
    restart: ${RESTART_MODE}
    domainname: ${MAILSERVER_DOMAIN}                    # Mail server A/MX/FQDN & reverse PTR = mail.domain.tld.
    hostname: ${MAILSERVER_HOSTNAME}
    labels:
      - traefik.enable=true
      - traefik.frontend.rule=Host:spam.${MAILSERVER_DOMAIN}
      - traefik.port=80
      - traefik.docker.network=prometheus
    # extra_hosts:                          - Required for external database (on other server or for local databases on host without docker)
    #  - "mailmariadb:xx.xx.xx.xx"              - Replace with IP address of MariaDB server
    #  - "redis:xx.xx.xx.xx"                - Replace with IP address of Redis server
    ports:
      - "25:25"       # SMTP                - Required
    # - "110:110"     # POP3       STARTTLS - Optional - For webmails/desktop clients
      - "143:143"     # IMAP       STARTTLS - Optional - For webmails/desktop clients
    # - "465:465"     # SMTPS      SSL/TLS  - Optional - Enabled for compatibility reason, otherwise disabled
      - "587:587"     # Submission STARTTLS - Optional - For webmails/desktop clients
      - "993:993"     # IMAPS      SSL/TLS  - Optional - For webmails/desktop clients
    # - "995:995"     # POP3S      SSL/TLS  - Optional - For webmails/desktop clients
      - "4190:4190"   # SIEVE      STARTTLS - Optional - Recommended for mail filtering
    env_file:
      - mail.env
    environment:
      - DBPASS=${DATABASE_USER_PASSWORD}       # MariaDB database password (required)
      - RSPAMD_PASSWORD=${RSPAMD_PASSWORD}     # Rspamd WebUI password (required)
@

在traefik.tom中,对于DNS子1和子2声明相同。 您对该错误有任何想法吗?

更改容器内部的网络(每个前端1个私有和1个主机,对于数据库仅1个私有/内部)。 检查日志(无间断)

0 个答案:

没有答案