It took me sometime to figure out setting up virtualhost for apache2 on Mac OSX Lion 10.7.4. I hope the following steps will be helpful.
- This is important, Edit httpd.conf located at /private/etc/apache2/httpd.conf. Uncomment the line
Include /private/etc/apache2/extra/httpd-vhosts.conf
- I like to have separate files for each vhost entries. There add the following line at the end of httpd.conf
Include /etc/apache2/sites/*.conf
- Now you can make new entries for any number of virtualhost you would want. Just name a file with extension conf inside /private/etc/apache2/sites/ directory and those files will be included.