Skip to content

Instantly share code, notes, and snippets.

@8bitDesigner
Created June 6, 2012 19:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save 8bitDesigner/2883929 to your computer and use it in GitHub Desktop.
Save 8bitDesigner/2883929 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>
@8bitDesigner
Copy link
Author

Understandably, given my preferences, this is gonna work best with ✨MacPorts✨. Let me know if you guys try this with any other package management systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment