Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How can I enable directory listings with Apache on Lion Server?

I'm running Lion Server with the Web and Wiki enabled. The web site displays OK. But if the URL refers to a directory with no index.html file I don't get a directory listing even though I've modified the apache config file to enable them. Now I may have made a mistake in the config. But what's odd is that instead of a directory listing I get the main Wiki home page. It looks like whenever the URL resolves to a directory that exists, but which contains no index.html file, the system displays the Wiki page. But I haven't figured out where this is configured, whether this is the expected behaviour, and if so how I'm supposed to enable directory listings in such cases. Any suggestions?

Mac Pro, Mac OS X (10.7.2), Lion Server

Posted on Oct 16, 2011 10:46 AM

Reply
3 replies

Oct 19, 2011 6:08 AM in response to _KM_

If the folder with your files is outside your Web DocumentRoot, you must add this statement first:


Alias /yourWebDirectory "/var/www/yourWebDirectory"


... which means "make that directory accesible via http://www.blablabla.com/yourWebDirectory"


After this line, you need to add the following statement:


<Directory "/var/www/yourWebDirectory">

Options Indexes FollowSymLinks

AllowOverride None

</Directory>


By default the "Apache 2 default site config file" is in /etc/apache2/sites/0000_any_80_.conf.default

Oct 19, 2011 11:41 AM in response to tArre

Thanks for the suggestions. However, I already have an alias set, and can successfully display the directory if it contains an index.html file. I had the <Directory> entry in httpd.conf, but tried putting it in /etc/apache2/sites/0000_any_80_.conf.default to see if it made a difference. But I still get the "Welcome to Mac OS X Lion Server" home page when I access the directory and it doesn't contain an index.html page. It's as if the mechanism used to display the wiki home page as a "default" action is conflicting with the mechanism to display a directory listing. But I can't see where the behaviour of displaying the wiki home page by default is set.

Oct 19, 2011 10:12 PM in response to _KM_

I've realized what the problem was. In the various files within /etc/apache2/sites the DirectoryIndex includes /wiki/ as one of the options. So this will always succeed and the directory index will never trigger. I hadn't realized you could specify a general path like this in DirectoryIndex, but now I realize you can the observed bahviour makes sense.

How can I enable directory listings with Apache on Lion Server?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.