0

I'm on my first steps with OS X and I'm trying to setup Apache so I can develop a website. I configured a new alias on /etc/apache2/other with the following content, pointing to my project folder, like this:

Alias /mySite /Users/me/Documents/workspace/mySite   
<Directory /Users/me/Documents/workspace/mySite>
  Options Indexes     
  Order allow,deny
  Allow from all 
</Directory>

However, accessing to localhost/mySite gives me a 403 forbidden. I have access to localhost (which I realize has its web folder at /Library/WebServer/Documents) and I have access to localhost/~me (which shows the content of ~/Sites). I also tried to deploy my site in that folders and I can have access to it, but my ideia was, at most (if configuring the site on Apache fails), to use a symbolic link there pointing to the real project location, but right now I'm also getting the same 403 with it. Can someone help me with this?

Thanks!

2 Answers 2

1

The default permissions on ~/Documents don't allow anyone but the owner access to it. Apache accesses the documents as the _www user, so if that user can't get to the web folder, you'll get a permissions error.

If this is the problem, there are a couple of possible solutions: you can either move the project folder outside of ~/Documents (e.g. /Users/me/workspace/mySite), or change the permissions on ~/Documents to allow Apache in (chmod +a "user:_www allow search" ~/Documents should do the trick).

2
  • So, you mean _www user can't access /Users/me/Documents, but it can access /Users/me? I assume ~/Sites has the same permissions that ~/Documents correct, and that is the reason why it's not working?
    – Rui
    Jan 4, 2012 at 12:50
  • The default permissions on ~, ~/Sites, and ~/Public allow everyone read access; all of the other default folders under ~ (~/Documents, ~/Library, ~/Desktop, etc) are locked down so only the owner has any access. When you create new folders and documents, they default to being readable by everyone unless you put them in a protected location (like ~/Documents). Jan 4, 2012 at 15:25
0

Perhaps

Options Indexes FollowSymLinks

and

DocumentRoot /Users/me/Documents/workspace/mySite

would be useful?

http://httpd.apache.org/docs/2.0/mod/core.html (See < Directory > Directive)

You must log in to answer this question.

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