Apache: 403 Forbidden error when trying to change DocumentRoot

I am developing several websites, but I prefer to store them in a directory at the root of my hard drive (let's call it /Websites) rather than in ~/sites or /Library/WebServer/Documents. I want to be able to preview php files locally for testing purposes, but am having trouble figuring out how to give Apache access to them without temporarily moving them into ~/Sites and back every time. The Apache documentation suggests two ways which I may point to /Websites: 1) by changing DocumentRoot in httpd.conf, or 2) through symbolic links.

The problem is, either method results in a 403 forbidden error. I assured that permissions were set the same way as the files Apache can access (755 for directories, 664 for files) and tried changing ownership to root, admin... but it didn't work and I'd prefer not to have all of my site files owned by root as it makes editing difficult.

What am I doing wrong? Any suggestions?

I also tried adding the following to httpd.conf but it had no discernible effect.

<Directory "/Websites">
Options +Indexes FollowSymLinks +ExecCGI
AllowOverride AuthConfig FileInfo
Order allow,deny
Allow from all
</Directory>

Assuming it did work, would changing the "Allow from..." line to "Allow from 127.0.0.1" or "Allow from localhost" along with "deny from all" be the proper way to let me preview on the local machine without serving my test pages to the entire internet?

Macbook Pro, Mac OS X (10.6.4)

Posted on Aug 22, 2010 2:55 PM

Reply
3 replies

Aug 22, 2010 7:14 PM in response to David McNeill

Did you change this to reflect new DocRoot?
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/Library/WebServer/Documents">

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Apache: 403 Forbidden error when trying to change DocumentRoot

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.