Skip to content

Instantly share code, notes, and snippets.

@developerworks
Created March 6, 2015 13:13
Show Gist options
  • Select an option

  • Save developerworks/8d3bf42b95aad9ea3755 to your computer and use it in GitHub Desktop.

Select an option

Save developerworks/8d3bf42b95aad9ea3755 to your computer and use it in GitHub Desktop.

I'm installed phoenix 0.9.0 follow by doc get started, and configured ssl follow by SSL.

My config/prod.exs configurations are:

use Mix.Config

config :user_system, UserSystem.Endpoint,
  url: [host: "localhost"],
  http: [port: System.get_env("PORT")],
  secret_key_base: "5FwE4UEfXnp+3O+oHQ84zNBqYsxu0NlIlYOwIn9m9SDKbP6/IT2JoMn5GBRJDyJ9"
  https: [
    port: 443,
    host: "localhost",
    keyfile: "/elixir-usersystem/app/priv/server.key",
    certfile: "/elixir-usersystem/app/priv/server.crt"
  ]

# ## SSL Support
#
# To get SSL working, you will need to add the `https` key
# to the previous section:
#
#  config:user_system, UserSystem.Endpoint,
#    ...
#    https: [port: 443,
#            keyfile: System.get_env("SOME_APP_SSL_KEY_PATH"),
#            certfile: System.get_env("SOME_APP_SSL_CERT_PATH")]
#
# Where those two env variables point to a file on
# disk for the key and cert.
  

# Do not pring debug messages in production
config :logger, level: :info

# ## Using releases
#
# If you are doing OTP releases, you need to instruct Phoenix
# to start the server for all endpoints:
#
#     config :phoenix, :serve_endpoints, true
#
# Alternatively, you can configure exactly which server to
# start per endpoint:
#
#     config :user_system, UserSystem.Endpoint, server: true
#

My self-signed certificate is generated with the following commands:

openssl genrsa -des3 -out server.key 2048
openssl rsa -in server.key -out server.key.insecure
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Run the netstat -an |grep 443 could not found any processes are listening on port 443.

Is there any issues about my configurations ?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment