Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I access http://localhost/ I get 403 Forbidden, but if I access http://localhost/~username it serves up pages. Things I've tried:

  • Checking error logs
  • Swapping out with original httpd conf files
  • Changing DocumentRoot to my user directory (after all that should work if I can access ~username)

I've seen 30 plus Q&A sites that all point to people having trouble with user directories being forbidden. I have the opposite problem, and so I'm tearing my hair out here.

share|improve this question

I actually ran into this same problem (at least the same symptoms) just today. In my case, I looked at /var/log/apache2/error_log and saw a bunch of errors like this:

[Mon Mar 19 15:30:30 2012] [error] [client ::1] Directory index forbidden by Options directive: /var/empty/

Then I looked in /etc/apache2/httpd.conf and saw these two lines…

DocumentRoot /var/empty

…and then later, these lines…

# Some comments were here
DocumentRoot "/Library/WebServer/Documents"

…so I figured that somehow MACOSXSERVER was getting defined, when it shouldn't be, since this machine is not a server machine. Then I remembered that I needed to install the Lion Server Admin tools on this machine, and the way Apple's documentation told me to do that was to install the Lion Server package from the Mac App Store on my admin machine, even though this wasn't intended to be a server machine. So maybe that actually/accidentally transmogrified my admin machine into a Mac OS X Server machine. To double-check, I ran:

$ sw_vers
ProductName:    Mac OS X Server
ProductVersion: 10.7.3
BuildVersion:   11D50

Sure enough, my machine was now reporting itself as Mac OS X Server, even though all I had wanted to do was put the Server Admin Tools on this machine.

Back to the Apache problem, I eventually found /etc/apache2/ReadMe.txt, which explained about those Mac OS X-specific Apache defines (be sure to read it yourself for more good info!), and then it said this:

Those IfDefine settings – MACOSXSERVER, WEBSHARING_ON, WEBSERVICE_ON – are set or not set by Apache's launchd plist, which is present in /System/Library/LaunchDaemons/org.apache.httpd.plist.

So in my case, I chose to fix it by editing in that launchd plist for Apache to not defined MACOSXSERVER, since I don't really consider my machine a server, and I want to control this stuff from the Web Sharing checkbox in the Sharing panel of System Preferences, not from

So, I edited this file:


To remove or comment out these lines, in the ProgramArguments array:


I chose to comment them out by putting SGML comment start/end markers before and after them like this:


After saving my changes to that plist file, I restarted Apache gracefully:

sudo apachectl graceful

…and it was all better!

I may have had to reload the page in my browser a time or two if my browser had cached a "403 Forbidden" result for the page I was trying to get to.

Even if this isn't the exact same root cause of your problem, I hope my saga helps you figure out your situation.

share|improve this answer
This helped me, thanks! – nobre Aug 23 '12 at 12:50
+1 for 'transmogrified' – hambonious Apr 16 '13 at 20:49
Something to note about Lion Server is that if the Web service in is started while Web Sharing is enabled, the Web service will have a DOCUMENT_ROOT of /var/empty. You need to first disable System Preferences > Sharing > Web Sharing before starting the Web service to prevent this. – Eric3 Dec 18 '13 at 16:30

Your Answer


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.