Skip to content

Instantly share code, notes, and snippets.

@d48
Forked from 8bitDesigner/ssl.md
Created June 6, 2012 19:58
Show Gist options
  • Save d48/2884345 to your computer and use it in GitHub Desktop.
Save d48/2884345 to your computer and use it in GitHub Desktop.
Getting Apache SSL working locally

Lovingly skimmed from this guide

  1. Find your local host name, and hang onto it for later use
$ hostname
  1. Create a self-signed SSL cert:
openssl req -new -x509 -days 365 -sha1 -newkey rsa:1024 -nodes \
-keyout server.key -out server.crt -subj \
'/O=Company/OU=Department/CN=[Your Hostname here]'
  1. Make server.* root readable, and move them to your apache config directory:
chmod 600 server.*
mv server.* /your/apache/conf/dir
  1. Add the following to your Apache hosts file:
LoadModule ssl_module modules/mod_ssl.so
Listen 443
ServerName [Your Hostname here]
  1. Add a vhost for each site you'll be working with:
<virtualhost *:443>
  SSLEngine on
  SSLCertificateFile "/your/apache/conf/dir/server.crt"
  SSLCertificateKeyFile "/your/apache/conf/dir/server.key"

  DocumentRoot /Users/dev/Sites/[site name]
  ServerName local.[site name].com
  ErrorLog /Users/dev/Sites/log/[site name]_error_log
</virtualhost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment