The begining
Start Apache:
Enabling VirtualHosts
Open httpd.conf file
sudo mate /etc/apache2/httpd.conf
Find the following line:
#Include /private/etc/apache2/extra/httpd-vhosts.conf
and uncomment it. To enable PHP5, find:
#LoadModule php5_module /opt/local/apache2/modules/libphp5.so
and uncomment it as well.
Adding VirtualHosts
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
DocumentRoot /Users/uzza/Development/workspace
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /Users/uzza/Development/sandbox
ServerName sandbox
</VirtualHost>
Adding the local hosts
Open hosts file:
and add following lines:
127.0.0.1 localhost
127.0.0.1 sandbox
The ending
Restart Apache
and check if you can open
http://localhost
http://sandbox