Generate a self-signed certificate and private key
-x509 makes openssl issue a self-signed certificate instead of a CSR, and -newkey rsa:2048 creates a fresh RSA key, with -nodes leaving it unencrypted so a server can read it without a passphrase. -subj sets the subject non-interactively, perfect for scripts. Use this for local testing only, since browsers will warn about the trust chain.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.