I've finally finished something I was banging my head with for quite some time. Here on modmyifone I found several partial instructions on hot to
enable Lighttpd server directory listing (with or without CSS styling).
kane.lai improved code of
DeathPrawn's dirlist generator. Improvements are listed at the end of this post.
I chose Lighttpd as it uses less resources (and I won't bother disabling it through BossPrefs).
Apache servers should display root folder content as soon as you delete index.html in ~/Sites. Lighttpd requires more attention
INSTRUCTIONS: HOW TO SETUP COOL DIRECTORY LISTING ON LIGHTTPD
1. Install Lighttpd and PHP (via Installer)
(after finished PHP installation you'll see a message "Please add /opt/iphone/bin/ to your $PATH", ignore it, it's all already set), restart iPhone, lighttpd will be started on the next boot.
2. Check if Lighttpd is installed correctly. Point your iPhone browser to 127.0.0.1 and you should be greeted by Lighttpd welcome screen.
3. Unpack "Lighttpd server.zip" archive (attached at the end of this post) and copy dirlist folder from archive to ~/Sites (/private/var/root/Sites) using your weapon of choice (WinSCP, Putty, Terminal/SSH, AFPd, SFTP...)
Also, rename dirlist to .dirlist (add a dot in front of the directory name, which will make folder invisible and it will not be shown in directory listing). Should you encounter any problems with renaming, navigate to /private/var/root/Sites and type following command in Terminal/SSH (small HOM icon in WinSCP).
Make sure that .dirlist is actually named .dirlist and not just dirlist or something else, because if it's not .dirlist, this thing won't work. Easy way for checking its name is navigating with MobileFinder (enable system access and showing of hidden files in MobileFinder's preferences) from your iPhone to folder /private/var/root/Sites. There you will see .dirlist. If you see folder named "2edirlist", it's not good. You have to rename it into .dirlist.
4. Edit lighttpd.conf located in /usr/local/etc/ just copy mine over your original (it's also inside .zip archive)
If you feel like editing it all over again, here it's what it takes...
this means you don't have to follow the next step (under stars) if you will overwrite your original .conf file with the modified one that you will find in attached zip file.*************************************************
+ Add two more server modules
Code:
,"mod_indexfile","mod_dirlisting"
After editing it should look like this..
Code:
server.modules = ( "mod_cgi","mod_indexfile","mod_dirlisting" )
+ Add line which defines index file
Code:
'index-file.names = ( "/.dirlist/dir-generator.php" )'
+ In cgi.assign array add at the end of line (together with comma)
Code:
, ".php" => "/opt/iphone/bin/php-cgi"
After editing it should look like this..
Code:
cgi.assign = ( ".pl" => "/usr/bin/perl", ".py" => "/usr/bin/python", ".rb" => "/usr/local/bin/ruby", ".cgi" => "", ".sh" => "", ".php" => "/opt/iphone/bin/php-cgi" )
+ Add two lines bellow in order to point out where the CSS style file is
Code:
dir-listing.activate = "enable"
dir-listing.external-css = "/.dirlist/iphonedirlist.css"
+ If you don't want other people to have access to files hosted on your iPhone (~/SItes/ content) ad the following line:
Code:
server.bind = "localhost"
When you change your mind and want to allow acces to hosted files, just comment the line above (add # sign in front) so that it looks like this..
Code:
#server.bind = "localhost"
After editing it should look like this..
Lighttpd with only folder listing turned on (looks much like Apache without index.html) and
screenshot of Lighttpd with PHP/CSS improved view
Thanks to
DeathPrawn,
DaveiPhone and
cazlar for their initial involvement in this. I've just collected it all together, tweaked CSS and provided screenshots

===============================
CHANGELOG OF KANE LAI'S TWEAKS
===============================
Version 1.5.1 (Apr 19, 2008)
* fixed a bug where folders/files with spaces in their name cannot be hyperlinked (sorry about this)
Version 1.5 (Apr 19, 2008)
+ added support for ".htm", ".html" and ".php" files
+ added experimental support for ".mp3" and ".mp4" files
Version 1.32 (Apr 5, 2008)
* fixed a bug where folders containing the "+" character fails to open
* fixed a bug where changing the orientation of Safari messes up the font size
Version 1.31 (Apr 3, 2008)
+ added icon for ".jpeg" files (in addition to ".jpg" files)
* added a space between icon and filename
* ignored the case of the file extension (".JpG", ".JPG", ".jpg" are the same)
Version 1.3 (Mar 31, 2008)
+ added icon for txt files
* increased thumbnail size and removed the filenames for photos (coz filenames are generally not important for photos)
* fixed a minor bug about hyperlinks
* renamed apple-touch-icon.png to favicon.png
Version 1.2 (Mar 30, 2008)
+ icons support - for PDF/DOC/XLS/folder, icons are shown; for JPG/GIF/PNG, picture preview are shown.
Version 1.1 (Mar 27, 2008)
* the original script fails to enter directory/file which contains the "#" character in directory name or filename
* when the length of file/dir is too long, the ">" at the right of the line get overlapped. now it's fixed.
+ the original script only shows 127.0.0.1 as the root folder name. i've added a constant in the script that allows the user to customize the name. i preset it as "Library"
+ web clip icon support. just put an icon named "apple-touch-icon.png" in the ".dirlist" folder (or use the one i attached). and try to add the web page to the home screen
+ the page auto scroll to hide the address bar of safari (only if the length of the list of files reached a full screen of safari)
CREDITS
===============================
kane.lai, -V-O-Y-A-G-E-R-, DeathPrawn, DaveiPhone and cazlar