Lighttpd help

Swift-wp

Expert Member
Joined
Apr 12, 2007
Messages
1,370
Reaction score
0
Location
Sandton
Hi Guys

I need some help with lighttpd. What I want to do is have the index.html page displayed and then have the directory listing below that, like as you see on http://ubuntu.mirror.ac.za/ubuntu-release/. What I succeed in doing is either displaying the index.html page or list the contents of the directory, but not both both together. I'm trying to find a solution as we speak, if anyone can help out it would be appreciated. Thanks.
 
I have used autoindex in Apache to do this.

I've known about Lighttpd for some time but never played with it, so I decided to install it and have a look :D.

First thing that struck me is that there's no autoindex module. It appears that the module names for Lighttpd and Apache are similar, so I get the impression that Lighttpd doesn't do autoindexing natively. I searched the documentation on lighttpd.net and didn't get any hits for autoindex either.

I will continue playing with it and see if I've missed something. I must say I like the simple config, reminds me a lot of Apache 1.3.x, just with a lot less <Directory> directives. Speaking of which, Lighttpd would have to support something similar for me to even consider using it.

BTW The built-in rrd support is very useful though.

---
Edit: Looks like something is in the works for the next release. There's a patch available too.

http://redmine.lighttpd.net/issues/show/1458
Category: mod_dirlisting
Target version: 1.4.21
Pending: No
Resolution:
Description

The start point for this patch is the will to get an official ubuntu repository (fr.archive.ubuntu.com) from apache to lighty. For this, we have to keep some of the mechanisms ubuntu gives us and transfer them from apache to lighty. I tried to implement some of the mod_autoindex things in lighty mod_dirlisting, keeping in mind that it should stay light.
The patch attached basically changes the following things :

* add dir-listing.encode-header and dir-listing.encode-readme, these options are booleans. It gives the ability to provide a valid html file as HEADER.txt and README.txt, these files are just printed before and after the actual listing. A further enhancement would be to choose the name of those files.
* add dir-listing.auto-layout, this option is a boolean. When disabled, it will remove the html part lighty was automatically outputing as the start of the page and the end (from <DOCTYPE to <body> and </body></html>). This lets the possibility to take care of those parts in the header and readme files.
* add dir-listing.pre-list, this option is a boolean. When enable, it will replace the <div></div> around the listing by
keeping the same css class.

---
Edit 2:

This looks like a solution if you don't want to patch and recompile:
http://phpautoindex.sourceforge.net/

phpAutoindex is a directory listing generator meant as a replacement for the Apache module autoindex.
phpAutoindex is more flexible and configurable than the Apache module. There are many input plugins that can be used to display information such as the size or the SHA1 hash of a file.

k, here is how I got phpautoindex working with Lighttpd:
(1) Unbziptar phpautoindex to the htdocs rootdir
(2) rename to phpautoindex
(3) mv config.default.en.php to config.php
(4) Optional: I did a 'find phpautoindex -type d -exec chmod 700 {}\;' for security purposes
(5) chown -R lighttpd:lighttpd phpautoindex/tmp
(6) Enable mod_rewrite in your lighttpd.conf and add the following rewrite rule:

Code:
url.rewrite                = ( "^(.*)/$"  => "/phpautoindex/index.php?dir=$1" )

(Just edit the commented one that's already in the config file.)

(7) Restart lighttpd

When you type in a URL ending with a directory you should get a pretty index.
 
Last edited:
Thanks. Just installed Apache2 and enabled it to read the .htaccess, worked like a charm. Screw Lighttpd.
 
Top
Sign up to the MyBroadband newsletter
X