Generating SSL key in Mac
Posted: May 19, 2011 Filed under: Linux, Shell Command Leave a comment »This info I found from
http://superuser.com/questions/73979/how-to-easily-create-a-ssl-certificate-and-configure-it-in-apache2-in-mac-os-x
Question:
I’d like to use my Mac OS X with https for local development tests. How can I easily make Apache2 respond to ssl, just for test proposes – I don’t want a real certificate, just a fake to make local https work ?
Answer:
Generating the private key:
output:
enter a passphrase for your private key.
Generating the CSR (certificate signing request):
It will request details like this:
State or Province Name (full name) [Berkshire]:
Locality Name (eg, city) [Newbury]:
Organization Name (eg, company) [My Company Ltd]:
Organizational Unit Name (eg, section) []:
Common Name (eg, your name or your server’s hostname) []:
Email Address []:
Please enter the following ‘extra’ attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:
it’s fairly straightforward, the common name is your server’s hostname as it says in brackets.
Generating the self signed certificate:
Configuring SSL in httpd.conf for Apache:
SSLCertificateFile /path/to/generated/server.crt
SSLCertificateKeyFile /path/to/generated/server.key
(replace path appropriately with the path to your certificate and key)
Restart Apache:
Apache will ask you for the passphrase to your key. If you think you will be shutting the server down a lot, you may want to remove the passphrase from the key so you can avoid entering it each time. If not, don’t worry about it. If so, complete this step after step 2 (Generating the CSR):
openssl rsa -in server.key.copy -out server.key