Traefik无法转发请求到httpd服务:连接被拒绝

时间:2017-10-15 10:32:51

标签: apache reverse-proxy devops lets-encrypt traefik

我在我的个人服务器上成功设置了Traefik。我正在运行几个容器,这个设置工作正常。

但是,对于我的一个容器,我收到502错误的网关错误。此容器是自定义httpd映像的实例。容器似乎工作正常,因为我可以使用服务器的IP地址(和端口)直接访问它。

但是,从域名访问它,我收到502错误。这是Traefik控制台中的错误:

traefik_1  | time="2017-10-15T10:12:54Z" level=debug msg="Look for provided certificate to validate [www.mydomain.xyz]..." 
traefik_1  | time="2017-10-15T10:12:54Z" level=debug msg="No provided certificate found for domains [www.mydomain.xyz], get ACME certificate." 
traefik_1  | time="2017-10-15T10:12:54Z" level=debug msg="Challenge GetCertificate www.mydomain.xyz" 
traefik_1  | time="2017-10-15T10:12:54Z" level=debug msg="ACME got domain cert www.mydomain.xyz" 
traefik_1  | time="2017-10-15T10:12:54Z" level=warning msg="Error forwarding to http://172.18.0.3:6050, err: dial tcp 172.18.0.3:6050: getsockopt: connection refused" 

在我的容器的docker-compose文件下面:

version: '2'
services:
  httpd:
    image: mydomain.azurecr.io/httpd:1
    ports:
      - "6050:80"
    restart: unless-stopped
    networks:
    - traefik_matterhorn
    labels:
      - "traefik.backend=mydomain"
      - "traefik.docker.network=traefik_matterhorn"
      - "traefik.frontend.rule=Host:www.mydomain.xyz"
      - "traefik.enable=true"
      - "traefik.port=6050"

networks:
  traefik_matterhorn:
    external: true

这是我的Traefik容器的docker-compose文件:

version: '2'
services:
  traefik:
    image: traefik:1.4-alpine
    restart: always
    ports:
      - 80:80
      - 4080:4080
      - 443:443
    networks:
      - traefik_matterhorn
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - ./traefik.toml:/traefik.toml

networks:
  traefik_matterhorn:
    external: true

这是我的traefik.toml文件

debug = false
checkNewVersion = true
logLevel = "ERROR"
defaultEntryPoints = ["https","http"]

[web]
# Port for the status page
address = ":4080"

[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 = "mydomain.com"
watch = true
exposedbydefault = false

[acme]
email = "me@mydomain.com"
storage = "acme.json"
entryPoint = "https"
OnHostRule = true

我正在运行Traefik v1.4.0-rc5 / roquefort

任何人都知道导致此Error forwarding to http://172.18.0.3:6050, err: dial tcp 172.18.0.3:6050: getsockopt: connection refused错误的原因是什么?

0 个答案:

没有答案