Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm configuring my development environment with a basic Apache HTTPd configuration.

But, to avoid a often problem, I want to map my test URL to my development folder.

I'm using Ubuntu.

My development path is located under the following example path:

/home/myusername/myworkspace/hptargetpath/src/pages

Considering the following symbolic link mapping:

#ls -l /opt/share/www/mydevelopmentrootpath:
lrwxrwxrwx 1 root root 77 2011-02-13 18:53 /opt/share/www/mydevelopmentrootpath -> /home/myusername/myworkspace/hptargetpath/src/pages

With this folder mapping, I configured Apache HTTPd with the following configuration:

<VirtualHost *:*>
        ServerName local.server.com
        ServerAdmin some@test.com
        DirectoryIndex index.html

        DocumentRoot /opt/share/www/mydevelopmentrootpath

        <Directory /opt/share/www/mydevelopmentrootpath/ >
                Options +Indexes
                Options +FollowSymLinks
                AllowOverride None
                Order allow,deny
                Allow from all
        </Directory>
</VirtualHost>

But, I'm receiving a 403 Forbidden error when I want to access index.html under the address http://local.server.com/index.html.

403 Forbidden
You don't have permission to access /index.html on this server.

On httpd debug log, I checked the following message:

[Sun Feb 13 19:34:47 2011] [error] [client 127.0.1.1] Symbolic link not allowed or link target not accessible: /opt/share/www/mydevelopmentrootpath

I'm thinking that this problem is been generated by some path permission. It's not a direct permission to directory, but some intermediate directory in the path.

There's a directive on httpd core Options:

SymLinksIfOwnerMatch
The server will only follow symbolic links for which the target file or directory is owned by the same user id as the link.

But, I tested it without effects.

Somebody may help me? I think that it's a trivial configuration on development environment.

Best regards,

And Past

share|improve this question
add comment

2 Answers

apache needs 'execute' right for all parent directories of /home/myusername/myworkspace/hptargetpath/src/pages in order to follow the symlink. you can grant that right with

chmod o+x /home
chmod o+x /home/myusername
chmod o+x /home/myusername/myworkspace
chmod o+x /home/myusername/myworkspace/hptargetpath
chmod o+x /home/myusername/myworkspace/hptargetpath/src
chmod o+x /home/myusername/myworkspace/hptargetpath/src/pages

in most cases, that helps.

share|improve this answer
add comment

We had a similar problem yesterday. we could solve it be changing the symlink ownership down to the userlevel:

chown -h <user>.<group> <symlink>

apache recognizes the symlink ownership and raises errors if symlink ownership does not fit. in the error_log you can only read "Symbolic link not allowed or link target not accessible". Don't forget the -h option since you change the target ownership otherwise.

share|improve this answer
add comment

Your Answer

 
discard

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.