相关文章推荐
睿智的柿子  ·  cef qt - Bigben ·  3 月前    · 
豪爽的豌豆  ·  还在为玩不了ChatGPT苦恼?这十几个开源 ...·  3 周前    · 
乖乖的铁链  ·  【道中华】辽宋夏金为何共奉“中国”之号?(上)·  8 月前    · 
飞奔的企鹅  ·  2024经纪公司新战场:入局做影视,冰火两重 ...·  8 月前    · 
英勇无比的麦片  ·  【图片】3DS模拟器专用DLC补丁【3ds模 ...·  1 年前    · 
重情义的椰子  ·  有轨电车相比公交有什么优势?相比BRT又如何 ...·  1 年前    · 
老实的葫芦  ·  贴吧404·  1 年前    · 
Code  ›  开发者社区
info https
https://cloud.tencent.com/developer/ask/sof/107986039
私奔的绿豆
2 年前
首页
学习
活动
专区
工具
TVP
返回腾讯云官网
提问
问 为用于码头集装箱内部的SSL证书生成私钥
Stack Overflow用户
提问于 2020-09-19 18:32:22
EN

我正在从事一个运行Docker并有3个容器的项目:

  • Django
  • PostgreSQL
  • traefik

现在我要生成一个私钥来向我的网站添加SSL证书,问题是我应该在哪里生成私钥?

在运行码头的主服务器内?

还是在Django容器里?

还是在Traefik集装箱里?

我使用的是 python:3.6-alpine trafik: for trafik& Django的

如果应该在容器中生成私钥,那么应该在容器内使用什么命令行来生成私钥?

实际上,我已经构建了private.key和certification.crt文件,在traefik.toml文件中引用了它们,并得到了以下错误:

failed to load X509 key pair: tls: failed to find any PEM data in certificate input

这就是为什么我认为问题在于我在主服务器中生成的private.key,而不是在任何容器中。

如果您想了解更多信息,请在 traefik.toml 文件中使用以下配置:

logLevel = "INFO"
defaultEntryPoints = ["http", "https"]
# Entrypoints, http and https
[entryPoints]
  # http should be redirected to https
  [entryPoints.http]
  address = ":80"
    [entryPoints.http.redirect]
    entryPoint = "https"
  # https is the default
  [entryPoints.https]
  address = ":443"
    [entryPoints.https.tls]
    [[entryPoints.https.tls.certificates]]
    certFile = "/certs/ new_cert_v2.chained.crt"
    keyFile = "/certs/hrattendence_gs-group_nl.key"
[file]
[backends]
  [backends.django]
    [backends.django.servers.server1]
      url = "http://django:5000"
[frontends]
  [frontends.django]
    backend = "django"
    passHostHeader = true
    [frontends.django.headers]
      HostsProxyHeaders = ['X-CSRFToken']
    [frontends.django.routes.dr1]
      rule = "Host:IP here"

以下是完整的错误消息:

traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=info msg="Using TOML configuration file /etc/traefik/traefik.toml"
traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=info msg="No tls.defaultCertificate given for https: using the first item in tls.certificates as a fallback."
traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=info msg="Traefik version v1.7.16 built on 2019-09-13_01:12:20PM"
traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=info msg="\nStats collection is disabled.\nHelp us improve Traefik by turning this feature on :)\nMore details on: https://docs.traefik.io/basics/#collected-data\n"
traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=error msg="failed to load X509 key pair: tls: failed to find any PEM data in certificate input"
traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=info msg="Preparing server http &{Address::80 TLS:<nil> Redirect:0xc000b04b40 Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc0008fba60} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=info msg="Preparing server https &{Address::443 TLS:0xc0007797a0 Redirect:<nil> Auth:<nil> WhitelistSourceRange:[] WhiteList:<nil> Compress:false ProxyProtocol:<nil> ForwardedHeaders:0xc0008fba80} with readTimeout=0s writeTimeout=0s idleTimeout=3m0s"
traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=error msg="Unable to add a certificate to the entryPoint \"https\" : unable to generate TLS certificate : tls: failed to find any PEM data in certificate input"
traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=info msg="Starting provider configuration.ProviderAggregator {}"
traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=info msg="Starting server on :443"
traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=info msg="Starting server on :80"
traefik_1_623bf12389b8 | time="2020-09-19T14:24:35Z" level=info msg="Starting provider *file.Provider {\"Watch\":true,\"Filename\":\"\",\"Constraints\":null,\"Trace\":false,\"TemplateVersion\":0,\"DebugLogGeneratedTemplate\":false,\"Directory\":\"\",\"TraefikFile\":\"/etc/traefik/traefik.toml\"}"
 
推荐文章
睿智的柿子  ·  cef qt - Bigben
3 月前
豪爽的豌豆  ·  还在为玩不了ChatGPT苦恼?这十几个开源平替也能体验智能对话开发者社区
3 周前
乖乖的铁链  ·  【道中华】辽宋夏金为何共奉“中国”之号?(上)
8 月前
飞奔的企鹅  ·  2024经纪公司新战场:入局做影视,冰火两重天_澎湃号·湃客_澎湃新闻-The Paper
8 月前
英勇无比的麦片  ·  【图片】3DS模拟器专用DLC补丁【3ds模拟器吧】_百度贴吧
1 年前
重情义的椰子  ·  有轨电车相比公交有什么优势?相比BRT又如何?|客运|brt|地铁线路_网易订阅
1 年前
老实的葫芦  ·  贴吧404
1 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
Code - 代码工具平台
© 2024 ~ 沪ICP备11025650号