SSL: Generating self-signed certificates with one openssl command

One command to generate SSL certificate with SAN (Subject Alternative Name).

SSL: Generating self-signed certificates with one openssl command
Photo by regularguy.eth / Unsplash
openssl req -x509 -newkey rsa:4096 -sha256 -days 3650 \ 
  -nodes -keyout example.key -out example.crt \ 
  -subj "/CN=example.com" \
  -addext "subjectAltName=DNS:example.com,DNS:www.example.com,IP:127.0.0.1"

Documentation:
https://www.openssl.org/docs/man1.1.1/man1/openssl-req.html