Store apache files in a Dropbox folder on OSX Mountain Lion

This tutorial shows you how to restore your /Sites folder and create a symlink to your Dropbox Folder

When you use Apache on OSX Mountain Lion, you may have noticed the ~/Sites folder is not used by default anymore. This means you cannot run websites at localhost/username out of the box. Localhost points to the physical location ~/Library/WebServer/Document and on my machine I was not able to create a symlink from this location to my Dropbox folder

Restore /Sites folder

On my machine this is: /Users/loek/Sites

cd /etc/apache2/users
sudo nano loek.conf

Where you replace loek with your own username

<Directory "/Users/loek/Sites">
Options Indexes Multiviews
AllowOverride All
Order allow,deny
Allow from all

Where you replace loek with your own username

By now you should be able to run a website at localhost/loek

localhost

sudo ln -s ~/Sites ~/Dropbox/Sites

dropbox

Removing the link should not delete the files in the target location but I recommend backing them up anyway. I’ll wait…

rm ~/Dropbox/Sites

The SymLink should be gone now. Please be careful with Terminal commands. You can do some serious harm to your machine using them and when in doubt…don’t use them!

Grüsse aus Berlin!
Loek