No love from OSX 10.8 Apache

On 2012/11/06, in osx, webdev, by a b

I was stumped and sad. Apple decided those who use their OSX computer for hacky things should have it harder in 10.8, though I’m not sure why. It’s well documented that the Web Sharing panel for Apache is gone. So is the Sites folder. Le Sigh…

There was some general derp, which I fixed. Google can tell you how to fix Apache in 10.8

I had user directories loading:
LoadModule userdir_module libexec/apache2/mod_userdir.so

I added:
/User/brownlee/Sites

I made sure that ‘/etc/apache2/users/brownlee.conf’ exists, is in use, and has the right values:

<Directory “/Users/brownlee/Sites/”>
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>

This all worked, mostly.  Apache could serve localhost/~brownlee, and even creating synlinks worked – but with continued derp.  Here is what drove me CRAY-CRAY:

Me creates symlink to the default web docs folder: ‘docs -> /Library/WebServer/Documents/’
This works.
That’s a directory that apache could server originally.

Creates a symlink to the folder my web projects are in – no dice. Fiddle every config file, restart Apache 14,000 times. It just won’t work. Quite confusing, but it has to be something… probably permissions… grrrr… grrrr….

I tried making the permissions and ownership of the web project folder match the WebSever/Documents folder (chmod a+rx, chown to root, wheel, chgrp, etc), but no dice.  I also tried various combinations of chmod/chown/chgrp with _www, staff, santa_claus … nada worky. Sobs. Hairpulling. Google, google, more google.

smashingheadintokeyboard.jpg

But here’s the deal: the access permission needs to be right down the entire path to the folder you’re trying to symlink. Doh. Not only that, but Apache needs read (sure!) and execute (oh…derp). So every folder down the chain needs a+rx? Double doh.

What fixed this in the end was setting the right permissions on my ~/Documents folder, which was the link in the chain that didn’t have ‘rx’ for Apache. Since ‘_www’ isn’t in ‘staff’, that folder needs o+rx permssion. Really. Now, of course you feel weird setting that, right? Because other is pretty broad to give read and execute, and you are paranoid.  You could create a group with _www and yourself, give that group the ownership of Documents, and make sure that group as rx rights. Then, only you and _www would have the permissions. I’m too lazy to do that.

Some day I’ll have to look at how my old 10.6 laptop is configured, just to see if it’s similar to what I ended up with. Thanks, Apple, for breaking this. I’m really enjoying wasting time getting it working again.

I found three blog posts helpful in sorting this out.  Thanks, people who are smarter than me!

 

 

Comments are closed.