Set up virtual hosts for MAMP

If you use the free version of MAMP this is the simple way to set up virtual hosts –

in /private/etc/hosts add a line for each virtual host like:

127.0.0.1 vhost.local

Then, as described in Supercharge Your MAMP Environment, create a vhost conf file with an entry for each virtual host like:

<VirtualHost *:80>
    ServerName vhost.local
    DocumentRoot /Applications/MAMP/htdocs/vhost.local/
    <Directory /Applications/MAMP/htdocs/vhost.local/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
</VirtualHost>
 

The above works fine for a few sites that change infrequently, but quickly becomes a hassle to manage if you have many sites. The method posted on postmodern.com may be an option. It did not work for me.

I’m now using MAMP PRO which I’ll write more about in another post.

2 thoughts on “Set up virtual hosts for MAMP”

  1. You’ll also need to declare a simple default VirtualHost if you want to use multiple hosts :)

    ServerAdmin webmaster@localhost
    DocumentRoot “TheSameAsYouUseWithMamp”

    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

Leave a Reply