【问题标题】:SSL for Phoenix working locally but not on production适用于 Phoenix 的 SSL 在本地工作但不在生产环境中
【发布时间】:2017-06-15 06:06:47
【问题描述】:

我有一个可以在本地使用 https 的 Phoenix/Elixir 应用程序,但是当我尝试将其更改为使用生产证书时,服务器没有响应并且没有显示错误消息。

In my dev.exs this was made with the hostname localhost

In prod.exs here are the keys. These were made with my production URL

我试图通过将主机添加到配置中的 https 部分来将本地主机更改为本地生产 url

https: [port: 443,
      host: "produrl.com"
      keyfile: "priv/keys/domain.key",
      certfile: "priv/keys/domain.crt"],

这会引发错误 sudo MIX_ENV=prod mix phoenix.server [info] Running LiteChartBe.Endpoint with Cowboy using http://localhost:80 [info] Application lite_chart_be exited: LiteChartBe.start(:normal, []) returned an error: shutdown: failed to start child: LiteChartBe.Endpoint ** (EXIT) shutdown: failed to start child: Phoenix.Endpoint.Server ** (EXIT) shutdown: failed to start child: {:ranch_listener_sup, LiteChartBe.Endpoint.HTTPS} ** (EXIT) shutdown: failed to start child: :ranch_acceptors_sup ** (EXIT) :badarg {"Kernel pid terminated",application_controller,"{application_start_failure,lite_chart_be,{{shutdown,{failed_to_start_child,'Elixir.LiteChartBe.Endpoint',{shutdown,{failed_to_start_child,'Elixir.Phoenix.Endpoint.Server',{shutdown,{failed_to_start_child,{ranch_listener_sup,'Elixir.LiteChartBe.Endpoint.HTTPS'},{shutdown,{failed_to_start_child,ranch_acceptors_sup,badarg}}}}}}}},{'Elixir.LiteChartBe',start,[normal,[]]}}}"} Kernel pid terminated (application_controller) ({application_start_failure,lite_chart_be,{{shutdown,{failed_to_start_child,'Elixir.LiteChartBe.Endpoint',{shutdown,{failed_to_start_child,'Elixir.Phoeni

如果我只是在本地主机文件中将 localhost 转发到 produrl,则不会引发任何错误,也不会使用 https 连接到服务器。

【问题讨论】:

    标签: ssl elixir phoenix-framework


    【解决方案1】:

    错误表明您为端点 (** (EXIT) :badarg) 的配置提供了错误的参数。我想这是因为您的主机网址后面缺少逗号。

    这可能无法解决您的问题,但这可能是您更改后显示错误消息的原因。

    【讨论】:

      猜你喜欢
      • 2021-08-14
      • 2016-07-16
      • 2018-03-23
      • 1970-01-01
      • 1970-01-01
      • 2011-06-12
      • 2019-03-30
      • 2019-08-17
      • 1970-01-01
      相关资源
      最近更新 更多