1

On Linux Fedora 15, Apache doesn't follow symlinks, and they did not show in directory index... Can you help me why?

Just to mention that in httpd.conf I do have :

<Directory />
    Options FollowSymLinks
</Directory>

Also, User and Group defined in httpd.conf are owners of proper directories where is web application saved...

Can you tell me what I'm doing wrong? Thank you in advance!!!

UPDATE: is a problem occured because target is on the other hard drive?

UPDATE 2: it follows symbolic links, but this link for some reason is not followed. It points to the dir on other hard drive.

UPDATE 3: there is "nothing special" after first direction, ie:

<Directory "/var/www/html">
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
  • I think the FollowSymlinks should be in your webroot-dir, possibly /var/www. – ott-- Nov 6 '11 at 18:54
  • What's the rest of your config look like? Just because you've set FollowSymLinks on the root, doesn't mean it's not unset somewhere else.. – Shane Madden Nov 6 '11 at 20:38
  • no, nothing special after first Follow... pls check updated part of my message... – user52869 Nov 6 '11 at 22:10
  • AllowOverride All makes it possible for FollowSymLinks to be turned off in a .htaccess-file. – Kvisle Nov 6 '11 at 22:16
  • 1
    Yes, it is because of SeLinux. Next line helped me: chcon -t httpd_sys_content_t /myDir/* Thank you all! – user52869 Nov 6 '11 at 22:45
3

Make sure that Apache has read permission in the directory the link points too. Giving read permission on the link itself is not sufficient.

0

If only this link is a problem, it makes me think the link is the problem and not the Apache config. Are you sure it is not broken or the target drive is not mounted properly? For a file on a seperate drive ls -l should show, for example:

-rw-r--r-- 1 user group size date time link_name -> /drive/mount/point/path/to/file/file_name

If it does not then you should remake the link using:

rm link_name
ln -s /drive/mount/point/path/to/file/file_name link_name

If the link is pointing to the right place, perhaps the target drive is not mounted. Remount it and try again. Best of luck!

0

I know I'm very late for this question, but maybe I can help someone else. I had the same problem and finally I solved it: you have to change permissions of all parent directories of the target of your symbolic link. In my case -e.g.- the link pointed to /run/media/username/device/subdirectory/target (I use arch linux). So I needed to change "username" and "subdirectory" access permissions (the other ones should be fine by default):

setfacl -m "u:http:r-x" /run/media/username/device/subdirectory
setfacl -m "u:http:r-x" /run/media/username

For the latter you need root permissions (and, of course, http is httpd user defined in httpd.conf).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.