Skip to content

Instantly share code, notes, and snippets.

@prestontimmons
Last active September 4, 2015 18:55
Show Gist options
  • Save prestontimmons/368654 to your computer and use it in GitHub Desktop.
Save prestontimmons/368654 to your computer and use it in GitHub Desktop.

Generate self-signed wildcard ssl certificate with openssl

1. Generate key

Replace *.example.com with your domain. When asked for CommonName during the openssl dialog, set it to *.yourdomain.com.

Generate::

sudo openssl genrsa -out example.com.key 1024
sudo openssl req -new -key example.com.key -out example.com.csr

Sign Key::

sudo cp example.com.key example.com.key.orig
sudo openssl rsa -in example.com.key.orig -out example.com.key
sudo openssl x509 -req -days 1000 -in example.com.csr -signkey example.com.key -out example.com.crt

2. Set up Apache

Sample Apache configuration::

<VirtualHost *:443>
  ServerName example.com
  SSLEngine On
  SSLCertificateFile "/etc/httpd/conf/certs/example.com.crt"
  SSLCertificateKeyFile "/etc/httpd/conf/certs/example.com.key"
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment