Generates a self-signed certificate for HTTPS testing.
mix phx.gen.cert mix phx.gen.cert my-app my-app.local my-app.internal.example.com
Creates a private key and a self-signed certificate in PEM format. These files can be referenced in the
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.
NOTE: when using Google Chrome, open chrome://flags/#allow-insecure-localhost to enable the use of self-signed certificates on
The list of hostnames, if none are specified, defaults to:
Other (optional) arguments:
-o): the path and base filename for the certificate and key (default: priv/cert/selfsigned)
-n): the Common Name value in certificate's subject (default: "Self-signed test certificate")
Requires OTP 20 or later.
© 2014 Chris McCord
Licensed under the MIT License.