Moving my Mac OS X Sites Directory to Dropbox

I’ve just started the adventure which I’ll call “Moving my Mac OS X (10.7.4) Sites Directory to Dropbox.” Here, is my diary.


Sources


Originally, my plan was to move the Sites folder from my user directory to my user Dropbox directory. And, reconfigure httpd.conf to point to the new location. There are several problems with this:

  • Mac requires that a directory named Sites remain in the user’s directory.
    (No problem. Just keep an empty directory with that name in that location.)
  • I would have to make my Dropbox directory globally readable.
  • I’m expecting to find my web files in ~/Sites

Still, I want to move my Sites directory to my Dropbox directory — Because, I believe that’s the only way to have Dropbox sync the content of Sites.

I’ll use a SymLink — as suggested in the above mentioned sources found on the Internet.

But, (before I start mucking with everything) first I’ll move the files in ~/Sites to a temporary folder on my desktop called tmp_Sites. Note: I already have another copy in my Dropbox directory.

According to harrybailey.com the next thing I should do is:

ln -s ~/Dropbox/Sites ~/Sites

This created a SymLink under ~/Sites called Sites. So, now I have the directory:

~/Sites/Sites

a.k.a.

/Users/samehlabib/Sites/Sites

I tried to put the symlink in ~/ itself but the command would not take because this directory already contains Sites (which can’t be removed.)

I made changes to httpd.conf.

DocumentRoot "/Users/samehlabib/Sites/Sites"
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/Users/samehlabib/Sites/Sites">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

I restarted my web server.

I had to give read permission to everyone on ~/Dropbox so that apache could load files from the ~/Dropbox/Sites directory.

Advertisements

About samehramzylabib

See About on https://samehramzylabib.wordpress.com
This entry was posted in Configure My Systems. Bookmark the permalink.

2 Responses to Moving my Mac OS X Sites Directory to Dropbox

  1. David says:

    You could move Sites using Terminal:

    $ sudo rm ~/Sites ~/Dropbox/Sites

    Then make a symbolic link

    $ ~/Dropbox/Sites ~/Sites

    You might have to fix any existing virtual domains you have setup in MAMP (or whatever)

  2. Pingback: Fresh Start with CodeIgniter | Sam's PHP How-To

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s