Reputation: 11362
I have a file in my ~/Sites
directory that works fine when I browse to it through coderama.local/~coderama/index2.php
Now I want to get tricky and move my index2.php
file to somewhere else on my system, so I do this by creating a symbolic link. However, when I try to access coderama.local/~coderama/index2.php
I now get the following error.
Any ideas anyone?
Thanks!
Forbidden
You don't have permission to access /~coderama/index2.php on this server.
Upvotes: 59
Views: 39054
Reputation: 4002
Had the same issue. Unfortunately, Marvo's answer wasn't enough.
The problem lies with the permissions set on every folder in the path, starting from ~/
. The directories needs the execute
flag set to be able to recurse the directory tree. So, in my case, I symlinked a theme folder from ~/Dropbox/projects/theme
to a wordpress install on ~/Site/wordpress
.
The answer was:
chmod a+x ~/Dropbox/
chmod a+rx ~/Dropbox/projects
This is an old issue, but if anyone reaches this page, it might be useful. :)
Upvotes: 56
Reputation: 1732
Also make sure you have a directive in your httpd-vhosts.conf
Otherwise you get the same '403 forbidden in the browser', with 'the client denied by server configuration in the error log.
Upvotes: 0
Reputation: 20021
In addition to Marvo's answer. What helped me was to Change the permission on Documents folder:
cd ~
chmod a+rx Documents/
Upvotes: 1
Reputation: 18143
That's a configurable Apache option. It appears that by default on Macs (and probably most installations) Apache is configured to not follow symbolic links. I'm guessing (as others mention above) that it's for security purposes.
But it can be really convenient at times to enable following of symbolic links, particularly during development of certain kinds of apps. What you need to do is 1) change the Apache configuration to allow the following of symbolic links, and then 2) restart Apache.
The configuration step is performed as follows:
a) cd /etc/apache2 (this is where Apache's configuration files are by default on a Mac)
b) you'll see a couple of directories here. One is called users
c) cd users
d) ls should reveal a .conf file with your login name (login.conf) I'm "marvo" so mine is named "marvo.conf"
e) Edit this file (I use vi) -- but you have to do it using sudo:
sudo vi marvo.conf
f) You'll see something like
<Directory "/Users/marvo/Sites/">
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</Directory>
g) Add the "FollowSymLinks" option so that the second line of that .conf file looks like:
Options Indexes MultiViews FollowSymLinks
(You can find other configuration options out there on the 'net. I found this page: http://httpd.apache.org/docs/2.0/mod/core.html#directory )
h) Save the file.
Now you have to restart Apache so that it picks up the configuration change. Googling around a bit, I found that this is most easily done from the command line with the following command:
sudo /usr/sbin/apachectl restart
(Found that at http://mcapewell.wordpress.com/2006/09/22/restart-apache-in-mac-os-x/ )
Now that symbolic link should work just fine on your Sites pages.
Upvotes: 101
Reputation: 11362
Seems like a security issue (also suggested by Matt)
http://discussions.apple.com/thread.jspa?threadID=1771399
Upvotes: 5
Reputation: 40203
I don't remember the specific reason why, but it doesn't work. It's a security issue. You can use XAMPP http://www.apachefriends.org/en/xampp-macosx.html or MAMP http://www.mamp.info/en/index.html to get around this.
Upvotes: 1