Reminder to self: how to set up a virtual host for localhost webdevelopment on OS X with MAMP

  1. DNS setup: add an entry for the local domain name in /etc/hosts, e.g.     foo.localhost

    and flush DNS cache with

    dscacheutil -flushcache
    1. Apache config (/Applications/MAMP/conf/apache/httpd.conf): add a virtual host entry like

      ServerName foo.localhost DocumentRoot /Users/eddywally/Sites/foo/localhost-dev/drupal and restart webserver, e.g. with

      /Applications/MAMP/bin/apache2/bin/apachectl restart

  2. Connect to http://foo.localhost:8888 (don't forget the nonstandard port number, unless you configured MAMP to use standard port 80).

further reading: