mix phx.gen.cert
SourceGenerates a self-signed certificate for HTTPS testing.
$ mix phx.gen.cert $ mix phx.gen.cert my-app.localhost my-app.internal.example.com
Creates a private key and a self-signed certificate in PEM format. These files can be referenced in the certfile and keyfile parameters of an HTTPS Endpoint.
WARNING: only use the generated certificate for testing in a closed network environment, such as running a development server on localhost. For production, staging, or testing servers on the public internet, obtain a proper certificate, for example from Let's Encrypt.
Arguments
The list of hostnames, if none are specified, defaults to:
- localhost
Other (optional) arguments:
-
--output(-o): the path and base filename for the certificate and key (default: priv/cert/selfsigned) -
--name(-n): the Common Name value in certificate's subject (default: "Self-signed test certificate")
Requires OTP 21.3 or later.
© 2014 Chris McCord
Licensed under the MIT License.
https://phoenix.hexdocs.pm/Mix.Tasks.Phx.Gen.Cert.html