how to change host and apache conf files for MAMP

Posted on May 27th, 2012 by thiswayup.
Categories: dev.

I use MAMP for my OSX dev, the regular edition doesn't include the easy way to add to the host file (so that you can have a dev domain eg mylocal.dev) and virtualhost to the apache.conf, you need to do it manually. But luckily it is very easy, this is for my future self to save finding it on google.

Adding to the host file

sudo cp /etc/hosts /etc/hosts.bak

sudo nano /private/etc/hosts

Add virtualhost

location: Applications/MAMP/conf/apache/httpd.conf

Add a virtual host

example entry:

<VirtualHost 127.0.0.1>

 ServerName hib.local

 DocumentRoot "/Users/joelee/Sites/hub.local/web"

 DirectoryIndex index.php

</VirtualHost>

0 comments.