I've been trying to setup a directory listing for a given directory on the same server (CentOS 7 with Apache httpd 2.4.6-88).
I came across an example to display public domain icons that seems to come with httpd and it works fine.

I tried copying my files next to the icons and it works great =) I can browse my directories and get the files in them.
The example is under /usr/share/httpd/icons/ and my files were under /usr/share/httpd/delivery

What I failed to do is list the files under /var/local/delivery that I created for that purpose.
The whole directory tree is here and I can browse all of them but impossible to show the files in them... I have an empty list at each "leaf" directory in my directory tree where the files should be.

Changing the owner of the directories/files does not seem to have an effect so I ruled out some kind of permissions problem.

Here is the configuration I added to /etc/httpd/conf.d/autoindex.conf

Alias /deliveries/ "/var/local/delivery/"
Alias /deliveries "/var/local/delivery/"

<Directory "/var/local/delivery/">
    Options Indexes MultiViews FollowSymlinks
    AllowOverride None
    Require all granted

Here is the IndexIgnore line in the same file

IndexIgnore .??* *~ *# HEADER* README* RCS CVS *,v *,t

What am I missing that "hide" my files (and not the directories) only when they are under /usr/share/httpd/delivery and not under /var/local/delivery?


I finally found what was missing. I'm not extremely familiar with SELinux but the problem seemed to come from there.

With this command:

chcon -R -t httpd_sys_content_t /var/local/delivery

I changed the SELinux context of my directory to let httpd access it. I found the solution here https://askubuntu.com/a/720162/814202 after trying to directly access one of the files that I wasn't seeing. Doing so gave me an error

access denied because search permissions are missing on a component of the path

which led me to the askubuntu question.

Hope this helps

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.