19 January 2009

OS X Leopard Virtual Hosts and Symbolic Links

I'll keep this quick.

  • Say you have an SVN working copy in your Documents Folder: Documents/SVN/MyProject/
  • There is a webroot in there: Documents/SVN/MyProject/webroot/
  • You've got the following in etc/hosts : 127.0.0.1 localhost dev
  • You've created a Virtual Host for "dev" in /private/etc/apache2/extra/httpd-vhosts.conf
  • You included FollowSymLinks in the virtual host Directory settings for Documents/SVN/MyProject/webroot
  • You get a "Forbidden" error when you try to view http://dev
  • You did a chmod -R 777 on the Documents/SVN/MyProject/webroot/ folder and you still get "Forbidden"


If this sounds familiar to you, then here's the solution:

Use: chmod a+x

Open a terminal window use the chmod command for each folder in the path to the webroot. In the example path, it would be:
chmod a+x ~/Documents
chmod a+x ~/Documents/SVN
chmod a+x ~/Documents/SVN/MyProject
chmod a+x ~/Documents/SVN/MyProject/webroot

As solutions go, this is quite a bad one as it makes your Documents folder accessible to all. But after hours of trying, that's all I could do to get this to work.

Has anyone got a better way?