1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
1. About
----------------------------------------------
Index-Style is a set of html, css and image files designed to make the default
apache file listings look a little nicer. The UI design is based almost
entirely on the great work done by the guys at http://www.reposstyle.com/,
although the code itself is largely done from scratch (as mod_autoindex doesn't
support XSLT).
2) Installation
----------------------------------------------
First, get a copy of the index-style folder - the easiest way is to change to
the document root of the domain you want to style, and check it out from
subversion (in my case the domain will be download.recurser.com) :
> cd /var/www/download.recurser.com
> svn co http://recurser.com/svn/misc/apache/index-style/
This should create an 'index-style' folder in your document root. Next, you
need to configure Apache to use the index-style files to style your directory
listings. I use the following config, which you'll need to adjust to match your
particular setup - the 'icons' alias and the 'mod_autoindex' section are the
main areas to pay attention to:
<VirtualHost *:80>
ServerName download.recurser.com
DocumentRoot /var/www/download.recurser.com
Alias /icons/ /var/www/download.recurser.com/index-style/icons/
<Directory "/var/www/download.recurser.com">
AllowOverride All
Order allow,deny
Allow from all
<IfModule mod_autoindex.c>
Options Indexes FollowSymLinks
IndexOptions FancyIndexing
IndexOptions VersionSort
IndexOptions HTMLTable
IndexOptions FoldersFirst
IndexOptions IconsAreLinks
IndexOptions IgnoreCase
IndexOptions SuppressDescription
IndexOptions SuppressHTMLPreamble
IndexOptions XHTML
IndexOptions IconWidth=16
IndexOptions IconHeight=16
IndexOptions NameWidth=*
IndexOrderDefault Descending Name
HeaderName /index-style/header.html
ReadmeName /index-style/footer.html
</ifModule>
</Directory>
</VirtualHost>
You'll need mod_autoindex for any of this to work - it should be installed by
default with Apache in most linux distributions.
3. Disclaimer
----------------------------------------------
The formatting relies on a few javascript hacks which may or may not work
exactly as intended if the output of your apache directory listings differs
a lot from what is expected. If the output appears strange, try playing
around with the javascript formatting in header.html, or drop me a line
at recurser.com if you need a hand.
|