I just spent a looooooong time trying to use Macports' Apache2 to serve documents out of my home directory. She no work!!!11 In the absence of any meaningful log data (that I could find) to go on, I decided to just plop the whole thing into the default document root ("/opt/local/apache2/htdocs"). Voila! Immense anger!

So, does Mac OS X have something like SELinux that might prevent Apache from doing something silly, like serve files from the place I want to serve them from? I read a little about Mac OS X's MAC framework, but that didn't seem to be what I was looking for.

I was using virtual hosts, as initially configured by Macports.

  • 1
    No; more likely the user that Apache was running as didn't have rights to the files. And how did you have Apache configured to point to the files in that location?
    – Shane Madden
    Sep 13 '11 at 21:25
  • I experimented with the file and directory permissions, finally resorting to making everything 777. Apache runs as www:www, so I modified the owner and group to match, finally resorting to root:wheel, same as the owner:group of the default htdocs. I had DocumentRoot pointing to the full path of my home directory ("/Users/alinabavi/projects/quickstart"), and created a Directory container with a default allow.
    – Ali Nabavi
    Sep 13 '11 at 21:27
  • 2
    Why not use Apple's supplied Apache?
    – mmmmmm
    Sep 13 '11 at 21:35

To answer your question as stated: Yes, MAC OS X has something similar to SELinux providing mandatory access control security polices and roles. As you have discovered it's called MAC and I believe it's based on the TrustedBSD implementation of the same name.

To answer your implicit question: No. MAC should not interfere with the ability to serve documents out of your home directory. Most likely either your permissions or your virtual host configuration is incorrect.

If I remember correctly the logs should be in /var/log/apache2 or /var/log/httpd. Please edit your question to contain the relevant parts of your virtual host configuration and logs.

  • Ack! I started going back up the directory tree, changing the virtual host's document root to the parent directory, then that directory's parent, then that directory's parent, etc., until a directory index was finally served on a directory. Looks like there were extended file attributes on my Dropbox directory that were unchanged by my recursive chmods. :-) Great! I have to leave work now but will investigate this further (xattr et al.).
    – Ali Nabavi
    Sep 13 '11 at 22:28
  • See my annotated link: diigo.com/0jkat Yep. Permissions :-) There was one directory up the tree that didn't have the right permissions, and that seems to be what was causing the error. Thank you all for your ideas!
    – hourback
    Sep 14 '11 at 19:11

Might this provide a clue? I'm not the expert here, but there are sharing preferences and permissions involved.

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .