2

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>
user52869
  • 21
  • 1
  • 1
  • 4

3 Answers3

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.

Krist van Besien
  • 1,862
  • 13
  • 16
1

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).

sgagolaz
  • 11
  • 1
  • If you are a developer working on source code in your home folder "/home/user" is the one www--data needs access to. This caught me out for ages. (Thanks for the light bulb moment). – MortimerCat Dec 26 '21 at 06:09
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!

erm410
  • 183
  • 3