Update the hosts file in /etc/hosts
to maintain multiple domains/hostnames on a local machine for 127.0.0.1 and setup a VirtualHost container in /Applications/MAMP/conf/apache/extra/httpd-vhost.conf
via /Applications/MAMP/conf/apache/httpd.conf
for a name-based virtual host.
- Related tutorial: http://osxdaily.com/2012/08/07/edit-hosts-file-mac-os-x/
- Documentation: http://httpd.apache.org/docs/2.2/vhosts/
Only suitable for MAMP users under OS X Lion, OS X Mountain Lion, and OS X Mavericks on Apache-Port 80 and MySQL-Port 3306.
Locate httpd.conf
: httpd -V
- Generate a private key:
openssl genrsa -des3 -out server.key 2048
- Generate certificate signing request:
openssl req -new -key server.key -out server.csr
(use server.dev for your Common Name) - Generate the certificate from the CSR for 5 years:
openssl x509 -req -days 1825 -in server.csr -signkey server.key -out server.crt
- Remove the password requirement from the server key:
cp server.key server.tmp
- Then:
openssl rsa -in server.tmp -out server.key
- Move the certificate files to
/Applications/MAMP/conf/apache/cert/