depicus

changing the digital world one bit at a time...

Blants (noun) the rants of a blogger

Adding a website in OSX for debugging or testing

December 4, 2011 by The Man

1. First edit your host file so you have a quick URL to use in your browser

sudo nano /private/etc/hosts

2. Edit the Apache config file to add a virtual server

sudo nano /etc/apache2/httpd.conf

or if we are on 10.9+ then allow by uncommenting

Include /private/etc/apache2/extra/httpd-vhosts.conf

And on 10.10 Yosemite uncomment

LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so

save then open

sudo nano /etc/apache2/extra/httpd-vhosts.conf

and add

# Depicus Web Site

ServerAdmin anybody@example.com
DocumentRoot "/Library/WebServer/Depicus/"
DirectoryIndex index.php

Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

ServerName Depicus
ErrorLog "/private/var/log/apache2/Depicus-error_log"
CustomLog "/private/var/log/apache2/Depicus-access_log" common

3. Restart Apache and you are good to go.

sudo apachectl -k restart