~欢迎来到*秋の网*部落格 Welcome to Chew's Web blog~ 使用火狐会更好 Download Best view using Mozilla Firefox. Download

Monday, July 7, 2014

Simple SSL Setup for MAMP

I met this problem during my development process. I unable to load the site when it comes to https

Here are the simple solution I did. Hope this might help you.

go to /Applications/MAMP/conf/apache/httpd.conf, and uncomment this line
# Secure (SSL/TLS) connections
Include /Applications/MAMP/conf/apache/extra/httpd-ssl.conf

go to /Applications/MAMP/conf/apache/extra/httpd-ssl.conf
change the following

DocumentRoot "/Applications/MAMP/htdocs"
#ServerName www.example.com:443
#ServerAdmin you@example.com
#ErrorLog "/Applications/MAMP/Library/logs/error_log"
#TransferLog "/Applications/MAMP/Library/logs/access_log"

SSLCertificateFile /Applications/MAMP/conf/apache/ssl/server.crt
#SSLCertificateFile "/Applications/MAMP/conf/apache/server.crt"
#SSLCertificateFile "/Applications/MAMP/conf/apache/server-dsa.crt"

SSLCertificateKeyFile /Applications/MAMP/conf/apache/ssl/server.key
#SSLCertificateKeyFile "/Applications/MAMP/conf/apache/server.key"
#SSLCertificateKeyFile "/Applications/MAMP/conf/apache/server-dsa.key"

Create a new folder /Applications/MAMP/conf/apache/ssl
navigate to the new folder
cd /Applications/MAMP/conf/apache/ssl

Create a private key, giving a password
openssl genrsa -des3 -out server.key 1024

Remove the password
cp server.key server-pw.key

openssl rsa -in server-pw.key -out server.key

Create a certificate signing request, pressing return for default values
openssl req -new -key server.key -out server.csr

Create a certificate
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt


Restart your MAMP server and u will able to list the path even with https://localhost

0 comments:

秋の网 - 赵のchew © 2009 - 2012. Leave me comment, I will reply u as soon as possible.