2017-08-29 10 views
0

私は数時間Traefikを試してきました。しかし、私は自分で解決できないような問題に遭遇しました。TLS config(v1.3.7)の作成中にエラーが発生しました

これは、HTTPからHTTPSへのリダイレクトとSSL証明書をテストするだけの非常に簡単な設定です。示しているようだ

docker-compose up 
Starting rocketchat_traefik_1 
Attaching to rocketchat_traefik_1 
traefik_1 | time="2017-08-29T13:45:55Z" level=info msg="Traefik version v1.3.7 built on 2017-08-25_08:56:06PM" 
traefik_1 | time="2017-08-29T13:45:55Z" level=info msg="Using TOML configuration file /etc/traefik/traefik.toml" 
traefik_1 | time="2017-08-29T13:45:55Z" level=debug msg="Global configuration loaded {"GraceTimeOut":10000000000,"Debug":false,"CheckNewVersion":true,"AccessLogsFile":"","TraefikLogsFile":"","LogLevel":"DEBUG","EntryPoints":{"http":{"Network":"","Address":":80","TLS":null,"Redirect":{"EntryPoint":"https","Regex":"","Replacement":""},"Auth":null,"Compress":false},"https":{"Network":"","Address":":443","TLS":{"MinVersion":"","CipherSuites":null,"Certificates":[{"CertFile":"ssl/mycert.pem","KeyFile":"ssl/mycert.key"}],"ClientCAFiles":null},"Redirect":null,"Auth":null,"Compress":false}},"Cluster":null,"Constraints":[],"ACME":null,"DefaultEntryPoints":["http","https"],"ProvidersThrottleDuration":2000000000,"MaxIdleConnsPerHost":200,"IdleTimeout":180000000000,"InsecureSkipVerify":false,"Retry":null,"HealthCheck":{"Interval":30000000000},"Docker":{"Watch":true,"Filename":"","Constraints":null,"Endpoint":"unix:///var/run/docker.sock","Domain":"docker.local","TLS":null,"ExposedByDefault":true,"UseBindPortIP":false,"SwarmMode":false},"File":null,"Web":{"Address":":8080","CertFile":"","KeyFile":"","ReadOnly":false,"Statistics":null,"Metrics":null,"Path":"","Auth":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}" 
traefik_1 | time="2017-08-29T13:45:55Z" level=info msg="Preparing server http &{Network: Address::80 TLS:<nil> Redirect:0xc4202f4ea0 Auth:<nil> Compress:false}" 
traefik_1 | time="2017-08-29T13:45:55Z" level=info msg="Preparing server https &{Network: Address::443 TLS:0xc42032c000 Redirect:<nil> Auth:<nil> Compress:false}" 
traefik_1 | time="2017-08-29T13:45:55Z" level=error msg="Error creating TLS config: tls: failed to find any PEM data in certificate input" 
traefik_1 | time="2017-08-29T13:45:55Z" level=fatal msg="Error preparing server: tls: failed to find any PEM data in certificate input" 
rocketchat_traefik_1 exited with code 1 

はと間違って何かがあります:私はそれを実行しようとすると、

私は、次のようdocker-compose.yml

version: '2' 

    services: 
     traefik: 
     image: traefik:v1.3.7-alpine 
     ports: 
      - "80:80" 
      - "443:443" 
      - "8080:8080" 
     volumes: 
      - /var/run/docker.sock:/var/run/docker.sock:z 
      - /opt/dockerapp/rocketchat/traefik/traefik.toml:/etc/traefik/traefik.toml:ro,z 
      - /opt/dockerapp/rocketchat/traefik/ssl:/etc/traefik/ssl/:ro,z 
     command: --logLevel=DEBUG 

マイtraefik.tomlしかし

defaultEntryPoints = ["http", "https"] 
[entryPoints] 
    [entryPoints.http] 
    address = ":80" 
    [entryPoints.http.redirect] 
    entryPoint = "https" 
    [entryPoints.https] 
    address = ":443" 
    [entryPoints.https.tls] 
     [[entryPoints.https.tls.certificates]] 
     CertFile = "ssl/mycert.pem" 
     KeyFile = "ssl/mycert.key" 
[docker] 
domain = "docker.local" 
watch = true 

[web] 
address = ":8080" 

である必要があり私の証明書。私は証明書が正常であることを知っています、それは私たちがApacheとNGINXでうまく使用しているワイルドカード証明書です。

私は既にthis possible answerを確認しましたが、証明書と秘密鍵の両方がこれらのパラメータと一致しています。

誰か光を当てることはできますか?

ありがとうございます!

+1

certfileにとのKeyFile – whites11

+0

の絶対パスを設定してみてくださいそして、それは私の問題を解決します!答えとして追加すると、私はそれを受け入れることができます:) – davidfm

+0

素晴らしい!私は助けてくれるとうれしい – whites11

答えて

2

traefikがあなたの証明書を見つけていないようです。 などcertfileにとのKeyFileの絶対パスを入れてみてください:

defaultEntryPoints = ["http", "https"] 
[entryPoints] 
    [entryPoints.http] 
    address = ":80" 
    [entryPoints.http.redirect] 
    entryPoint = "https" 
    [entryPoints.https] 
    address = ":443" 
    [entryPoints.https.tls] 
     [[entryPoints.https.tls.certificates]] 
     CertFile = "/etc/traefik/ssl/mycert.pem" 
     KeyFile = "/etc/traefik/ssl/mycert.key" 
[docker] 
domain = "docker.local" 
watch = true 

[web] 
address = ":8080" 
+0

問題は解決しました。ありがとう! :) – davidfm

関連する問題