OpenSSL

To allow secure HTTPS connection on port 443, we can use self-signed SSL certificates.

  1. Generate a private key. The below command generates a 2048-bit RSA private key.

openssl genpkey -algorithm RSA -out server.key
  1. Generate a certificate signing request (CSR). A CSR is a request sent to a Certificate Authority (CA) to obtain a TLS certificate. To sign it, we need our private key generated in above command.

openssl req -new -key server.key -out server.csr
  1. Self-sign the CSR.

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

Last updated