2017-12-15 19 views
0

무조건 모든 요청을 백엔드로 전달하려고합니다.하지만 방문하려고하면 404가 계속됩니다. 여기에 내 구성이 있습니다. 8081과 load-balancer 용기 내부에서 http://server1 :traefik은 백엔드로 무조건 앞으로 전달하기 위해 404를 반환합니다.

고정 표시기 - compose.yml

version: '3.3' 
services: 
    load-balancer: 
    image: traefik:1.5-alpine 
    ports: 
     - 8080:80 
    volumes: 
     - ./traefik:/etc/traefik 
    server1: 
    build: server1 
    ports: 
     - 8081:80 

traefik.toml

defaultEntryPoints = ["http"] 
debug = true 
logLevel = "DEBUG" 
[accessLog] 

[entryPoints.http] 
address = ":80" 

[frontends.dummy] 
backend = "dummy" 
entrypoints = ["http"] 
[frontends.dummy.routes.all] 
rule = "PathPrefix:/" 

[backends.dummy.servers.server1] 
url = "http://server1:80" 

나는 아무 로컬 호스트에서 문제 서버 1에 액세스 할 수 있습니다. 그러나 404

디버그 로그

load-balancer_1 | time="2017-12-15T12:56:09Z" level=info msg="Using TOML configuration file /etc/traefik/traefik.toml" 
load-balancer_1 | time="2017-12-15T12:56:09Z" level=info msg="Traefik version v1.5.0-rc2 built on 2017-12-06_03:07:42PM" 
load-balancer_1 | time="2017-12-15T12:56:09Z" level=info msg=" 
load-balancer_1 | Stats collection is disabled. 
load-balancer_1 | Help us improve Traefik by turning this feature on :) 
load-balancer_1 | More details on: https://docs.traefik.io/basic/#collected-data 
load-balancer_1 | " 
load-balancer_1 | time="2017-12-15T12:56:09Z" level=debug msg="Global configuration loaded {"LifeCycle":{"RequestAcceptGraceTimeout":0,"GraceTimeOut":0},"GraceTimeOut":0,"Debug":true,"CheckNewVersion":true,"SendAnonymousUsage":false,"AccessLogsFile":"","AccessLog":{"format":"common"},"TraefikLogsFile":"","TraefikLog":null,"LogLevel":"DEBUG","EntryPoints":{"http":{"Network":"","Address":":80","TLS":null,"Redirect":null,"Auth":null,"WhitelistSourceRange":null,"Compress":false,"ProxyProtocol":null,"ForwardedHeaders":{"Insecure":true,"TrustedIPs":null}}},"Cluster":null,"Constraints":[],"ACME":null,"DefaultEntryPoints":["http"],"ProvidersThrottleDuration":2000000000,"MaxIdleConnsPerHost":200,"IdleTimeout":0,"InsecureSkipVerify":false,"RootCAs":null,"Retry":null,"HealthCheck":{"Interval":30000000000},"RespondingTimeouts":null,"ForwardingTimeouts":null,"Web":null,"Docker":null,"File":null,"Marathon":null,"Consul":null,"ConsulCatalog":null,"Etcd":null,"Zookeeper":null,"Boltdb":null,"Kubernetes":null,"Mesos":null,"Eureka":null,"ECS":null,"Rancher":null,"DynamoDB":null,"ServiceFabric":null,"Rest":null,"API":null,"Metrics":null,"Ping":null}" 
load-balancer_1 | time="2017-12-15T12:56:09Z" level=info msg="Preparing server http &{Network: Address::80 TLS:<nil> Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc42060ea60} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s" 
load-balancer_1 | time="2017-12-15T12:56:09Z" level=info msg="Starting server on :80" 
load-balancer_1 | 172.21.0.1 - - [15/Dec/2017:12:56:17 +0000] "GET/HTTP/1.1" - - - "curl/7.54.0" 1 - - 0ms 

마지막 액세스 로그 명령

curl localhost:8080                                                            

에서이며 반환을 반환 localhost:8080 유지 나는 싶지 않아

404 page not found 

docker 백엔드를 사용하여 traefik이 전통적인 round-robin을 수행하도록하고 싶습니다. 컨테이너. 가능한지 궁금해?

답변

0

좋아, 여유 가입 한 후, Machael Matul는 진입 점

[file] 

후 어딘가에 선언 및 백엔드가 작동하려면, 그것은 프론트 엔드에 루트 선언 앞에 있어야한다 당신이 [파일]을해야합니다 지적했다. 예 :

debug = true 
logLevel = "DEBUG" 
defaultEntryPoints = ["https","http"] 

[accessLog] 

[web] 
address = ":8080" 
    [web.auth.basic] 
    users = ["admin:md5hashedpassword"] 

[acme] 
    email = "[email protected]" 
    storage = "/acme.json" 
    entryPoint = "https" 
    OnHostRule = true 
    [acme.httpChallenge] 
    entryPoint = "http" 

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

    [entryPoints.https] 
    address = ":443" 
    [entryPoints.https.tls] 

[file] 
watch = true 

[backends] 
    [backends.buffalo] 
    [backends.buffalo.loadbalancer.stickiness] 
    [backends.buffalo.servers.server1] 
    url = "http://node1:3000" 

    [backends.buffalo.servers.server2] 
    url = "http://node2:3000" 

    [backends.backendNginx] 
    [backends.backendNginx.loadbalancer.stickiness] 
    [backends.backendNginx.servers.server1] 
    url = "http://nginx1:8080" 

    [backends.backendNginx.servers.server2] 
    url = "http://nginx2:8080" 

    [backends.ai6forum] 
    [backends.ai6forum.loadbalancer.stickiness] 
    [backends.ai6forum.servers.server1] 
    url = "http://10.140.0.9:80" 

[frontends] 
    [frontends.frontend1] 
    backend = "buffalo" 
    [frontends.frontend1.routes.web] 
    rule = "Host:xyz.com" 
    entrypoints = ["http","https"] 
    passHostHeader = true 
    passTLSCert = true 
    priority = 10 

    [frontends.nginx] 
    backend = "backendNginx" 
    [frontends.nginx.routes.web] 
: 전체의

[frontends] 
    [frontends.frontend1] 
    backend = "buffalo" 
    [frontends.frontend1.routes.web] 
    rule = "Host:xyz.com" 
    entrypoints = ["http","https"]