One-liner to create self-signed SSL certificates (for testing purposes or local network)

Last updated:

openssl req -new -x509 -days 365 -sha1 -newkey rsa:1024 -nodes -keyout server.key -out server.crt -subj '/O=Company/OU=Department/'

where Company, Department and should be replaced by your server's specific values.

you might need sudo before all that;

N.B. - the CN value should match what is actually shown in the browser URL bar. Otherwise you might get browser warnings saying that the certificate was meant for another domain.

More info

Helped with this article: Owner (#httpd @ freenode)

Dialogue & Discussion