Enabling Directory Listings in Apache2.2

apache-2.2

I've searched far and wide and am unable to figure out what is messing up my configuration. I'm running on Arch x86_64 if that helps anyone.

Short version

I've enabled Option Indexes, restarted Apache and I get back a 404 page not found when trying to get a directory listing for a folder. Disabling dir_module doesn't help, and I don't want to use user_dirs module. If I type in the full path, the files render (.log files).

Details

Apache is running fine (I've got other directories running properly). When I try to share a directory whose contents I want listed via autoindex, I get back a 404 page not found. Apache's logs only show cache misses and 404's trying to hit the alias defined below. My main httpd.conf has:

LoadModule autoindex_module modules/mod_autoindex.so
LoadModule dir_module modules/mod_dir.so
LoadModule alias_module modules/mod_alias.so
...
<Directory "/srv/http">
   Options Indexes FollowSymLinks
   AllowOverride None
   Order allow,deny
   Allow from all
</Directory>

<IfModule dir_module>
   DirectoryIndex index.html index.php
</IfModule>
...
Include conf/extra/httpd-test-dir.conf

In http-test-dir.conf I have:

Alias /test_dir /home/user/dir
<Directory "/home/user/dir">
   AllowOverride All
   Options Indexes FollowSymLinks MultiViews
   IndexOptions FancyIndexing
   Order allow,deny
   Allow from all
</Directory>

I've tried commenting out the dir_module lines and restarting apache with no luck. I can get to the files in /home/user/dir/ manually via:

http://hostname/test_dir/2012-04-06/result.log

Unfortunately the folder paths change so I can't hard code them and I don't want to use user_dirs module. I checked permissions and all files/folders from / to /home/user/dir/ are

drwxr-xr-x

Any help would be greatly appreciated. Thanks.

Best Answer

Figured it out!!!

Turns out it was Passenger module running (for one of my other sites). I had to modify http-test-dir.conf as follows:

Alias /test_dir /home/user/dir
<Directory "/home/user/dir">
   AllowOverrid All
   Options Indexes FollowSymLinks MultiViews
   IndexOptions FanciyIndexing
   PassengerEnabled off  <------Added this line
   Order allow,deny
   Allow from all
</Directory>

Hopefully this will help someone else who is running Rails applications. In my case it was GitLab.