Setup Sub Domain in OSX 10.9 Mavericks
First of all, setup Apache, MySQL, PHP in you mac. You can do that by following http://blog.jambura.com/2014/01/17/get-apache-mysql-php-with-mcrypt-and-phpmyadmin-working-on-osx-10-9-mavericks/.
Edit your /private/etc/hosts file
sudo nano /private/etc/hosts
It should look like this
If you put swi.dev in you browser you will see “It works”. We have to update our /private/etc/apache2/httpd.conf to allow subdomains
sudo nano +477 /private/etc/apache2/httpd.conf
Uncomment Include /private/etc/apache2/extra/httpd-vhosts.conf line. It should look like this
Now we have to edit httpd-vhosts.conf to point document root for swi.dev.
sudo nano /private/etc/apache2/extra/httpd-vhosts.conf
then add the following
<VirtualHost *:80> DocumentRoot "/Users/zakirhyder/Sites/swi" ServerName swi.dev ServerAlias www.swi.dev ErrorLog "/private/var/log/apache2/swi.dev-error_log" UseCanonicalName Off </VirtualHost>
Now restart apache and your subdomain is ready.
sudo apachectl restart