Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

Okay, so I fixed this about 5 mins later by putting this

<Directory "/usr/local/apache2/htdocs/Binarytales">
    Options Indexes FollowSymLinks  
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

inside my virtualhost declaration. so in the end it read as thus:

NameVirtualHost *:80

<VirtualHost *:80>
    DocumentRoot /usr/local/apache2/htdocs
    ServerName localhost
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /usr/local/apache2/htdocs/Binarytales
    ServerName binarytales.local

    <Directory "/usr/local/apache2/htdocs/Binarytales">
    	Options Indexes FollowSymLinks
    	AllowOverride All
    	Order allow,deny
    	Allow from all
    </Directory>
</VirtualHost>

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.

share|improve this answer
    
you should accept your own answer here –  Jeff Atwood Oct 15 '09 at 10:12

I would have tried a bind mount first. Presuming it works on Mac OS X like it does on Linux:

mount --bind /path/one /path/two
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.