Local Domains in MAMP (Virtual Hosts)
(This has been tested in version 2 and 3 of MAMP)
Set MAMP’s ports
Open up MAMP, click on preferences, then go to the ports tab. Click “Set to defualt Apache and MySQL ports”. Click okay and shutdown MAMP.
Set the domain in the hosts
Open up a terminal and navigate to your root user directory. Then do these commands (you may have to use
Look for the line that says:
Add a space and then the name you would like to use. I’ll use test.dev:
127.0.0.1 localhost test.dev
Now save the document.
Allow Virtual Hosts in MAMP
Virtual hosts are turned off by default. To turn this feature on open
/Applications/MAMP/conf/apach2/httpd.conf and search for the following lines (usually at the bottom of the file):
Now simply uncomment the line so it looks like:
Set the domain in the MAMP config
Unlike the MAMP Pro, the free version of MAMP does not have a gui for adding and removing custom domains (virtual hosts). There is an easy workaround though.
/Applications/MAMP/conf/apache/extra/ in the finder. Then open up the document named
At the bottom of the document add this code for your custom doamin. Again, in this example I’m using the domain
test.dev and a directory named
test.dev in my sites directory:
Get MAMP and Chrome Running
Now you can open MAMP and start up its servers.
Quit and reopen Chrome if it wasn’t already off during this process and go to
http://test.dev in this case.
You now have a local domain set up for developing purposes!