Apache won't autoindex

13.4k Views Asked by At
  • Oracle Linux 7.3 (RHEL derivative)
  • Apache 2.4.6

I'm setting up a repository in /srv/www for yum, scripts, and kickstart files, served via httpd. I want an auto-index, so I don't have any index.html. And, this is the only thing this internal server will do. So, httpd.conf:

DocumentRoot "/srv/www"

<Directory "/srv/www">
  AllowOverride all
  Options Indexes FollowSymLinks
  Require all granted
</Directory>

However, I still get the error message:

[autoindex:error] [pid 12345] [client <IP address>:<port>] AH01276: Cannot serve directory /srv/www: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive.

Except that the Options directive allows auto-indexing! I've tried Options All. I've tried Options +Indexes +FollowSymLinks. I've looked at 7 or 8 Google hits. Nothing is working.

Setting LogLevel debug doesn't increase messaging.

What have I missed?

4

There are 4 best solutions below

0
On BEST ANSWER

As noted here, in the absence of an index.html (or other configured index file), the welcome page configured at /etc/httpd/conf.d/welcome.conf will take precedence over other configurations via its LocationMatch directive. Rename the file so it doesn't end in .conf and auto-indexing works.

0
On

Obviously landing in another virtualhost or Directory without indexes enabled, or a .htaccess getting in the way.

Set "AllowOverride none" first, since it is absurd to have it active if you are not using any .htaccess file (and since you have access to the main server you don't need it). Once you set AllowOverride, restart the server in case you added Indexes recently and didn't restart to apply changes.

If the issue persists, run apachectl -S and make sure you are landing in the correct virtualhost.

0
On

I just want to add that, after updating my mac to Catalina, my apache stopped working with that same error. I had to:

  • uncomment the required modules (php7, rewrite, directory, etc...)
  • add a + sign to the Options (Options +FollowSymLinks +Multiviews +Indexes)

This worked for me.

0
On

Solution: Ensure two apache modules are running:

  1. mod_autoindex.so
  2. mod_dir.so

In your case, mod_autoindex.so is running. Now enable the second one.

PS: Keep Options -Indexes. It's important. It makes sure that directory listings are disabled, as you shouldn't allow anyone to pay a visit to every directory on your server (some with rather private content such as CMS's directories).