Skip to content

Instantly share code, notes, and snippets.

@alexdiliberto
Created April 9, 2018 03:44
Show Gist options
  • Save alexdiliberto/67d0680be184396f83a686a80990eafd to your computer and use it in GitHub Desktop.
Save alexdiliberto/67d0680be184396f83a686a80990eafd to your computer and use it in GitHub Desktop.
Self Signed Certs working with MAMP and Chrome 65+
  1. cd ~/.ssl

  2. Generate new .key and .crt file

# SEE: https://github.com/webpack/webpack-dev-server/issues/854#issuecomment-292445914

openssl req \
    -newkey rsa:2048 \
    -x509 \
    -nodes \
    -keyout scsheltierescue.dev.key \
    -new \
    -out scsheltierescue.dev.crt \
    -subj /CN=scsheltierescue.dev \
    -reqexts SAN \
    -extensions SAN \
    -config <(cat /System/Library/OpenSSL/openssl.cnf \
        <(printf '[SAN]\nsubjectAltName=DNS:scsheltierescue.dev')) \
    -sha256 \
    -days 3650
  1. Copy newly generated .key and .crt to MAMP directory
cp scsheltierescue.dev.{crt,key} /Applications/MAMP/conf/apache
  1. Open /Applications/MAMP/conf/apache/httpd.conf and uncomment Include /Applications/MAMP/conf/apache/extra/httpd-ssl.conf

  2. Open /Applications/MAMP/conf/apache/extra/httpd-ssl.conf and edit the following keys within the <VirtualHost...> tag

<VirtualHost *:443>
  SSLEngine on
  SSLCertificateFile "/Applications/MAMP/conf/apache/scsheltierescue.dev.crt"
  SSLCertificateKeyFile "/Applications/MAMP/conf/apache/scsheltierescue.dev.key"
</VirtualHost>
  1. Hit Command (⌘) + Spacebar and type Keychain Access to open the Keychain Access App
  2. Import your ~/.ssl/scsheltierescue.dev.crt file
  3. Right click it and select "Get Info". Then click "Trust" and set "When using this certificate" to "Always Trust."
  4. Restart Chrome and Restart MAMP
  5. Navigate to https://scsheltierescue.dev/ or https://localhost and it should work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment