凤凰城的SSL在本地工作但不在生产中

时间:2017-06-15 06:06:47

标签: ssl elixir phoenix-framework

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

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部分来将localhost更改为本地生产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转发到本地hosts文件中的produrl,则不会抛出任何错误,也不会使用https连接到服务器。

1 个答案:

答案 0 :(得分:0)

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

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