2004.05_Charly's Column-Php Directory Index.pdf
(
1546 KB
)
Pobierz
Layout 1
Charly’s column
SYSADMIN
Looking Good
It doesn’t hurt to pay attention to appearances. Viewed from the administra-
tor’s perspective, pepping up the boring directory lists served up by an Apache
Web server is simply a question of style.
BY CHARLY KÜHNAST
all, I don’t work in the fashion
trade. However, from time to
time I do look in the mirror and decide
it’s time to head downtown and treat
myself to a new outfit.
A strangely similar thing happens
when I view the directory listings in a
browser (see Figure 1). For this year’s
Spring Collection
, I went in for the
PHP Directory Indexer [1]. Check out
Figure 2 – neat, huh? The package works
with Apache 1.3 and 2.0, and only
requires mod_php4. The key is the
Direc-
toryIndex
statement in your Apache
http.conf
:
When users navigate to a directory con-
taining one of these index files, they get
to see that file. If the directory does not
have an index file, Apache serves up a
directory listing like the one shown in
Figure 1.
The PHP Directory Indexer is not diffi-
cult to install. Unpacking the archive file
reveals the
docs
and
icons
directories,
and two files called
inc_indexer.php
and
indexer.php
. The
docs
directory contains
pretty much what you might expect,
installation guides in English and Por-
tuguese.
icons
has a few sets of new
pictographs, which I then copied into my
Apache
icons
directory using the follow-
ing command:
my case the line is
DocumentRoot
“/srv/www/htdocs”
. I then entered
cp /usr/local/indexer/*.php
U
/srv/www/htdocs/
to copy the files to the appropriate
directory. Now I can modify the
Directory
Index
line in
httpd.conf
:
DirectoryIndex index.php
U
index.html index.htm
cp -r /usr/local/indexer/
U
icons/* /srv/www/icons/
DirectoryIndex index.php index
U
.html index.htm /indexer.php
Of course your Apache will need read
access to these files – my Apache uses
the
nobody
account.
Don’t forget the forward slash, as the file
resides in the Web Server’s root direc-
tory. Finished! The indexer goes to work
after re-launching the Apache server. If
you want to enhance your Apache’s new
look, check out
inc_indexer.php
for more
details.
Modifying the
DocumentRoot
The next step is to copy the two PHP
files to your Apache directory. The
DocumentRoot
line in your
httpd.conf
will tell you which directory this is. In
■
INFO
Figure 1: The Apache directory listing is very
dreary.
[1] PHP Directory Indexer:
http://indexer.
adamastor.org/?cat=menu
SYSADMIN
Mediawiki
..................................
54
Learn how to launch your own PHP based
wiki site to collect enormous amounts of
information for a knowledge database..
Admin Workshop
...................
60
How to communicate with processes by
sending signals. Discover new efficient ways
in which to kill.
Figure 2: Add PHP Directory Indexer to your site
for a touch of elegance.
Charly Kühnast is a
Unix System Manager
at the data- center in
Moers, near Germany’s
famous River Rhine. His
tasks include ensuring
firewall security and
availability and taking care of the
DMZ (demilitarized zone).
www.linux-magazine.com
May 2004
53
The Sysadmin’s Daily Grind: PHP Directory Index
N
ow I’m not a vain person. After
Plik z chomika:
SOLARIX33
Inne pliki z tego folderu:
2010.01_Web Wall-Protecting Web Servers with Mod_Selinux and Sepostgresql.pdf
(482 KB)
2010.01_Rate Limiting-Making Sure Your Application is Available.pdf
(480 KB)
2010.01_Box of Legends-the Sys Admin's Daily Grind-Archivemail.pdf
(558 KB)
2009.12_Wireshark-Dissecting Network Traffic.pdf
(483 KB)
2009.12_Scan Free-Exploring the Openvas Vulnerability Scanner.pdf
(590 KB)
Inne foldery tego chomika:
Ask Klaus
Beginners
Comment
Community
Community Notebook
Zgłoś jeśli
naruszono regulamin