Skip to content

Instantly share code, notes, and snippets.

@hitautodestruct
Last active August 29, 2015 14:18
Show Gist options
  • Save hitautodestruct/76e063f2064fd2481fb3 to your computer and use it in GitHub Desktop.
Save hitautodestruct/76e063f2064fd2481fb3 to your computer and use it in GitHub Desktop.
How to configure MAMP on OSX to allow for vHosts file and multiple domains
  1. Open up httpd.conf (/Applications/MAMP/conf/apache/httpd.conf)

  2. Uncomment the line under Virtual Hosts:

    Looks like this:

    # Virtual hosts
    #Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
    

    Should look like this:

    # Virtual hosts
    Include /Applications/MAMP/conf/apache/extra/httpd-vhosts.conf
    
  3. Open up http-vhosts.conf (/Applications/MAMP/conf/apache/extra/httpd-vhosts.conf)

  4. Remove all example entries except this NameVirtualHost *:80.

  5. Now add the following lines to your file:

    <VirtualHost *:80>
        ServerAdmin webmaster@dummy-host.example.com
        DocumentRoot "/Users/myusername/mysite/"
        ServerName example.com
        ServerAlias example.com *.example.com
    #    You can uncomment the below line if you need to specify where your log file goes
    #    ErrorLog "logs/dummy-host.example.com-error_log"
        <Directory "/Users/myusername/mysite/">
            Options Indexes FollowSymLinks Includes
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>
    
  6. You can add as many of the above as you need changing the DocumentRoot, ServerName, ServerAlias and Directory entries accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment