MAMP PRO allows you to setup website directly through provide GUI (Graphical User Interface) but in MAMP (free), you will have to setup it up manually. There following 3 steps are needed to setup a local site or Virtual Host in MAMP.
- Setup local host first, issue the following command in Terminal (command prompt)
Add a new entry at the bottom in the following form
mysitename can be any name that you want to choose. You will access you site by tying mysitename in URL.
- Edit httpd.conf. Select Finder->Go->”Go to folder”. Type /Applications/MAMP/conf/apache/httpd.conf. Open this file in your favorite text editor. I use textmate. Go to line #569 or search for Virtual hosts. Comment out the following line so that it looks like this
# Virtual hosts Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
- Now go to https-vhosts.config, which is sitting inside the same folder in the ‘extra’ subfolder. Edit the file as the following
CustomLog "logs/dummy-host.example.com-access_log" common
Notice that I used port 8888. The default port is 80. It is not required if you want to use default port, you can simply use * that would indicate any port.
Last thing, you should copy the following above the first virtual host that we entered above. This way you can access localhost:8888 correctly.
<VirtualHost *:8888> DocumentRoot "/Applications/MAMP/htdocs" ServerName localhost </VirtualHost>
Do not forgot to restart the webserver (both apache and mysql). Also make sure you access the site by speccing the port 8888, like this
Issue connecting to MySQL DB
I had an issue connecting to mysql DB even though the supplied username and password were correct. I fixed that by simply creating a new user, giving it all privileges, by going to privilege tab in myphpadmin:8889.
MAMP PRO to MAMP
On thing I noticed when my MAMP PRO trial (15 days) expired, it deleted the database that I had created in mysql as well. Not sure if this is a bug in the MAMP PRO, but you may want to watch out for it.