I'm trying to set up an Apache Virtual Host for local development on a fresh install of Ubuntu 11.04. Here's my virtual host config inside /sites-available:
<VirtualHost *:80> ServerName morpho.local ServerAlias www.morpho.local ServerAdmin webmaster@localhost DocumentRoot /home/james/projects/morpho # Log file CustomLog /var/log/apache2/morpho.local-access.log combined </VirtualHost>
I've added the symlink in /sites-enabled and restarted Apache. The document root contains a dummy "Hello World" index.html and nothing else. The www-data user is the owner of the directory and the index.html.
I get a 403 Forbidden when I browse to morpho.local, and this line is written (twice) to the Apache error log:
(13)Permission denied: /home/james/projects/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable
This seems weird to me, because it's looking for a .htaccess file one directory up from the document root. Just to see what would happen, I created a .htaccess in that directory, and gave it 777 permissions and set owner and group to www-data. Same error in the log.
My guess is that I've missed something I need to do with permissions, but the fact that it's looking for a .htaccess one directory back is confusing.
Again, this is a fresh Ubuntu/Apache install and I haven't configured anything besides this single Virtual Host.
Edit: I got it working by setting the x permission on my dev folder, /home/james/projects. This allowed the www-data Apache user to see inside the directory. I'll try ghm1014's setup from the answers because that seems like a better solution. Although it seems like it would still require the x permission in order for www-data to follow the symlink, so I don't know if it gets around having to set that or not.
Thanks for your answers, regardless.