I have a self compiled version of Apache 2 running under Mac OS X Leopard. It's a default install at /usr/local/apache2 and work fine.
Today I wanted to add a virtual host so I could access a particular folder with the domain name http://binarytales.local
So I added 127.0.0.1 binarytales.local
to /etc/hosts
, fluch the dns cache and, yey, I could access my server via that address.
I wanted to be able to access, via my newly created local domain name, a subfolder in in my working web server. So I set up the following vhosts file
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /usr/local/apache2/htdocs
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot /usr/local/apache2/htdocs/ProjectX
ServerName binarytales.local
</VirtualHost>
Browsing to localhost
works fine, I get the files I always used to get. Browsing to binarytales.local
gives me an internal server error.
I did a bit of investgating and discovered that I had set htdocs to be a symlink to /Users/me/Sites
so I tried setting my vhost to
<VirtualHost *:80>
DocumentRoot /Users/me/Sites/ProjectX
ServerName binarytales.local
</VirtualHost>
This didn't work either. Now I'm getting Forbidden You don't have permission to access / on this server.
So I tried DocumentRoot /Users/me/Sites
and got the same forbidden message.
Finally I have tried
DocumentRoot /usr/local/apache2/htdocs2
ServerName binarytales.local
Where /usr/local/apache2/htdocs2
is a symlink to Users/me/Sites/ProjectX
. And I also tried it with Users/me/Sites
. I'm getting the same "Forbidden" error.
I have checked the user and group settings on everything is root/wheel apart from the stuff in `Users/me/Sites/' which is me/wheel. All the directors are chmod -x for everyone.
I'm totally stuck and don't have a clue what to try next!
My question title is crap. Please do change it to/suggest something better.
Best Answer
Okay, so I fixed this about 5 mins later by putting this
inside my virtualhost declaration. so in the end it read as thus:
NameVirtualHost *:80
I think the magic juice here is
Options ... FollowSymLinks
but it anyone has a good explanation as to why this works then please let me know, or if there is a better/alternative solutions.