Tag Archives: ssl mac localhost

Configure HTTPs on Localhost for testing purposes on MAC OS

11 Apr

Step 1: Generate a Private Key

 openssl genrsa -des3 -out ssl.key 1024

Step 2: Generate a CSR 

openssl req -new -key ssl.key -out ssl.csr

Step 3: Remove Passphrase from key

cp ssl.key ssl.key.org
openssl rsa -in ssl.key.org -out ssl.key

Step 4: Generating a Self-Signed Certificate

openssl x509 -req -days 365 -in ssl.csr -signkey ssl.key -out ssl.crt

Step 5: 

   OPEN /private/etc/apache2/httpd.conf

   UNCOMMENT the line LoadModule ssl_module libexec/apache2/mod_ssl.so by removing # in front of it

   UNCOMMENT the line Include /private/etc/apache2/extra/httpd-ssl.conf

   OPEN  /private/etc/apache2/extra/httpd-ssl.conf

   UPDATE  DocumentRoot to your website path

   UPDATE ServerName to Localhost

   COMMENT SSLCACertificatePath‘ and ‘SSLCARevocationPath’ if there,

   MAKE A FOLDER in /private/etc/apache2/ with name ssl

   COPY ssl.crt and ssl.key in ssl folder

   UPDATE SSLCertificateFile with  /private/etc/apache2/ssl/ssl.crt

   UPDATE SSLCertificateKeyFile with  “/private/etc/apache2/ssl/ssl.key”

   THEN sudo apachectl restart

 

Enjoy