Apache2.2 Course
Apache2.2 Course
Apache2.2 Course
2 under
Linux
Bob Dowling
University of Cambridge Computing Service
rjd4@cam.ac.uk
Jon Warbrick
University of Cambridge Computing Service
jon.warbrick@ucs.cam.ac.uk
SLESs Apache package is called apache2. SLES comes with various tools which can
install and update packages, including rpm, yast2, and rug. We will use rug, which
can fetch packages, install them and resolve package interdependencies. We assume
that the system is already configured with details of a suitable installation source.
# rug install apache2
Resolving Dependencies...
The following packages will be installed:
apache2 2.2.3-16.2 (SLES10-Updates)
apache2-prefork 2.2.3-16.2 (SLES10-Updates)
apache2-prefork-2.2.3-16.2.i586[SLES10-Updates] needed by
apache2-2.2.3-16.2.i586[SLES10-Updates]
libapr1 1.2.2-13.2 (http://bes.csi.cam.ac.uk/install/SLES10-i386?ali...
libapr1-1.2.2-13.2.i586[SUSE-Linux-Enterprise-Server-i386-10-0-200...
libapr-util1 1.2.2-13.2 (http://bes.csi.cam.ac.uk/install/SLES10-i38...
libapr-util1-1.2.2-13.2.i586[SUSE-Linux-Enterprise-Server-i386-10-...
Proceed with transaction? (y/N) y
Downloading Packages...
Transaction...
Transaction Finished
What happened here? First rug selected the most recent version of the apache2 package, and then it identified additional packages that will be needed by the one we
explicitly asked it to install, so-called dependencies. One of these, apache2-prefork,
provides one particular flavour of the actual web server. Following confirmation from
us, rug then downloaded and installed .
If we had access to the necessary package files, perhaps from a shared server or because we had already downloaded them, then we could have simply installed them
using the rpm. However if we did that wed have been responsible for selecting the
most recent version of each package, and also for identifying and resolving the dependency issues.
/etc/init.d/apache2: is the script run at system startup, and other times, to start
/usr/lib/apache2/
/usr/share/apache2/:
/var/log/apache2/:
In addition, the directory /srv/www was created by the base SLES install and provides the default location for files served by the web server. In particular, the htdocs
subdirectory, which is initially empty, is the basic website. Anything put here will appear on the website. See the Section called Quick and Dirty Web Server for how to get
a web site up and running as quickly as possible. Other subdirectories of /srv/www
support software that we wont be covering in this course.
Note that the /srv/www directory tree is owned by root. Any changes to the website
as the system currently stands need to be done by root
Programs included with the web server
/usr/sbin/ab2:
/usr/sbin/htdbm2,
/usr/sbin/htdigest2,
/usr/sbin/htpasswd2:
These
manipulate
user
and
password
information
for
web
access controls. We will see htpasswd2 and htdigest2 later in
the Section called Access control by client identity in Chapter 10 but we will not be
considering the other commands in this course.
/usr/sbin/logresolve2:
/usr/sbin/apache2ctl: This
/usr/sbin/httpd2-prefork: This
/usr/sbin/httpd2.
However, it is not used by a SLES system because there is a system-wide log rotation facility which is used instead for consistency with the rest of the system. This
will be considered in detail in the Section called Log rotation in Chapter 7.
This is a helper program for Apache that lets the server run
external programs (e.g. CGI programs) as a different user than the user running
the web service itself. As we will not be covering CGI programming in this course
we will not be making any use of this program. As it is a setuid root program, you
may want to remove it if you dont need it.
/usr/sbin/suexec2:
/usr/sbin/apxs2:
This
is
a
tool
for
building
Apache
modules
from
source.
We
will
use
this
in
the Section called University of Cambridge Raven authentication in Chapter 10
when we build a module to let our server use the Universitys Raven
authentication service.
The 2 on the end of the names of these programs is a feature of SLESs packaging of Apache - it would allow Apache 1 and Apache 2 packages to coexist on the
same server. In many other installations the commands will not have the additional
2. They may also be in different locations, for example some may be in /usr/bin/
rather than /usr/sbin/.
2:off
3:off
4:off
5:off
6:off
2:on
3:on
4:on
5:on
6:off
The next time the system is rebooted, the web server will be started. If you dont
want to wait until a reboot, or dont want to reboot, then it can be manually started
by running the script that would be run at boot time.
# /etc/init.d/apache2 start
Starting httpd2 (prefork)
done
If you take this easy approach then you need to know the following few facts.
You can make life much simpler for yourself (as the system administrator) if you create a group of users who are allowed to edit the document tree /srv/www/htdocs/.
We cover the steps needed to achieve this later in the course.
3
Apache documentation
Apache comes with a large amount of documentation which many people seem to
ignore! SLES provides a copy of the manual for the appropriate version of Apache in
the package apache2-manual. If you install this package and use the quick and dirty
approach above then a copy of the manual is available at http://server/manual/
# rug install apache2-doc
Resolving Dependencies...
The following packages will be installed:
apache2-doc 2.2.3-16.2 (SLES10-Updates)
Downloading Packages...
Transaction...
Transaction Finished
To understand name-based virtual hosting consider just the first two lines. The GET
request only includes to the local element of the URL. The second line specifies the
host name that is being asked for it.
The first line declares that this is a request from a client that wishes to read information from the server. GET is the most common HTTP method.
/index.html
The second term in the first line is the local element of the URL requested. Note
that the leading part of the URL containing the server name has been stripped
out.
HTTP/1.1
The final element declares that the query is couched in the language of version
1.1 of the HTTP standard.
Host: www.dept.cam.ac.uk
The second line indicates which server the query was addressed to. It is this
element of the query that allows a web server to distinguish between web sites
6
This optional line identifies the browser. Some servers vary the output according
to this header, but you should remember that it is a hint and can be trivially
changed on many browsers.
In this case Mozilla identifies the browser as one of the Netscape/Mozilla family and 5.0 ties it down to a version of Mozilla. Other information allows us to
identify that it is a browser is running under Linux on an Intel platform, that it
was built for the en-GB locale, and indicates the version numbers of the various
components.
Accept: text/xml,application/xml,application/xhtml+xml,text/html;
q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
This specifies the formats the browser can accept and how keen it is on them.
Servers can be configured to negotiate various different formats of response depending on these parameters.
text/xml,application/xml,application/xhtml+xml means that the browser
is happy to accept MIME content types text/xml, application/xml, or
application/xhtml+xml; otherwise it will accept text/html but the qualifier
q=0.9 means that, given a choice, the browser would prefer to receive one of the
earlier types (default q=1.0) than text/html. text/plain means that it can accept
plain text too. The qualifier q=0.8 makes this less preferred than anything else.
The browser has a general preference for image/png. Finally it will accept any
format (*/*) but is not keen on them (q=0.5).
We will meet MIME content types again in Chapter 4.
Accept-Language: en-gb,en;q=0.7,es;q=0.3
Just as there was negotiation over MIME content type there can also be negotiation over MIME transfer encoding. This is a mechanism for the server and
browser to agree on a way to (typically) compress the data stream prior to transfer.
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
The final topic for negotiation is the character set of any text that will be sent. In
this case, ISO Latin 1 is preferred, with UTF-8 and indeed everything else coming
second.
Connection: keep-alive
This tells the server that it need not close the network connection after sending
back the response to the query as other requests may be sent down the same connection. As setting up and tearing down connections are expensive operations
this is a major efficiency boost.
Keep-Alive: 300
This instructs the server to keep the connection alive for 300 seconds in case
there are any more requests. After 300 seconds of idleness the server will drop
7
The web server will not start now. First it will complain about not having a configuration file. Perhaps we should have kept a backup...
# /etc/init.d/apache2 start
/apache2/httpd.conf: No such file or directory
The command line was:
/usr/sbin/httpd2-prefork -f /etc/apache2/httpd.conf
failed
Next, we will create an empty configuration file and see that that just changes the
error message.
# touch /etc/apache2/httpd.conf
# /etc/init.d/apache2 start
Starting httpd2 (prefork) no listening sockets available, shutting down
Unable to open logs
startproc: exit status of parent of /usr/sbin/httpd2-prefork: 1 failed
It must be admitted that as error messages go, no listening sockets available, shutting down is a fairly obscure way of saying youve not told me what to do. Actually it means, youve not told me to listen for any incoming requests so I might as
well quit now.
We will start by detailing an absolutely minimal configuration file that gets the server
launched but nothing else.
Listen
80
The command to tell the server to listen for connections is Listen. This takes one
argument, specifying which interface and port to listen on. The default port assigned
to web services by the Internet authorities is port 80. Quoting just a port number
9
failed
Unfortunately, the launched web server then immediately shuts down. By default,
the web server logs error messages in an error long file. In SLES, as in many Linux
distributions, this will be /var/log/apache2/error_log. We can look in there for
clues as to what we need next.
[Wed Feb 21 15:54:58 2007] [alert] (2)No such file or directory:
getpwuid: couldnt determine user name from uid 4294967295,
you probably need to modify the User directive
What does this error message mean? It means that the web server needs to know who
to run as. A standard SLES install comes pre-configured with a user wwwrun and a
group www for the web server. We need to tell it to use them. This is done with the
User and Group commands in the configuration file.
User
Group
wwwrun
www
While we are at it, we add one unnecessary line which has the effect of turning off
various settings which default to being on. We do this for two reasons. The first is
didactic; we want to meet these options explicitly when they become relevant rather
than relying on defaults. The second is our decision to provide what was specified
and no more. This line will turn off everything and we must explicitly turn on what
we want.
Listen
User
Group
Options
80
wwwrun
www
None
And if we start the web server now, with this four line configuration file, it launches
just fine and stays running.
# /etc/init.d/apache2 start
Starting httpd2 (prefork)
done
# tail -1 /var/log/apache2/error_log
[Wed Feb 21 16:31:46 2007] [notice] Apache/2.2.3 (Linux/SUSE) configured -resuming normal operations
# ps -ef | grep apache2
root
6377
1 0 16:31 ?
00:00:00 /usr/sbin/httpd2-prefork ...
wwwrun
6378 6377 0 16:31 ?
00:00:00 /usr/sbin/httpd2-prefork ...
wwwrun
6379 6377 0 16:31 ?
00:00:00 /usr/sbin/httpd2-prefork ...
wwwrun
6380 6377 0 16:31 ?
00:00:00 /usr/sbin/httpd2-prefork ...
wwwrun
6381 6377 0 16:31 ?
00:00:00 /usr/sbin/httpd2-prefork ...
wwwrun
6382 6377 0 16:31 ?
00:00:00 /usr/sbin/httpd2-prefork ...
root
6392 3260 0 16:34 pts/0
00:00:00 grep apache2
But, as the figure shows, its not a single daemon that gets launched. There are six of
them. The first column of the ps output gives the owner of the process and the second
gives the process ID or PID. One of the server processes is owned by user root and
the others by user wwwrun. That root-owned process is the parent process of all the
other processes. What happens is that the startup script that we manually invoked
launched the parent, root-owned process (PID 6377). It in turn launched five child
processes owned by wwwrun (PIDs 6378 - 6392).
10
At the moment, the server has nothing to serve. Every attempt to request a
page from it results in a 404, not found error. If we look in the error log file,
/var/log/apache2/error_log we will see the error message:
[Wed Feb 21 16:39:34 2007] [error] [client 131.111.10.33] File does not exist:
/srv/www/htdocs/index.html
Virtual hosts
However, as we are planning on hosting two web sites we ought to be thinking
about two locations, one for each value of the Host: header. We should also think
about what to do with requests that have neither www.dept.cam.ac.uk nor
prg.dept.cam.ac.uk as the Host: headers value.
We shall create two subdirectories, WWW and PRG, of /srv/www for the two websites.
We will also create two groups, www-admin and prg-admin, which will contain the
people entitled to update the sites.
Setting up and using the WWW and PRG directories.
1. Creating the groups
# groupadd -r www-admin
# groupadd -r prg-admin
The -r option on groupadd sets up a system group. These are no different from
user groups in reality, but SLES assigns them from a different range of numeric
IDs to keep them apart.
2. Setting up the directories
Next we have to create /srv/www/WWW and /srv/www/PRG and set them up so that
these newly created groups have sway over them. After creating the directories
we need to do a number of things.
We must change the group of the directories. It starts out controlled by the root
group.
We must change the permissions so that this group can add things.
We must set the permissions so that anything created in the directory also is
controlled by the webadmin group.
The change of group is done with the chgrp command and the two changes of
permissions can be done with a single use of the chmod command.
#
#
#
#
#
#
mkdir
chgrp
chmod
mkdir
chgrp
chmod
/srv/www/WWW
www-admin /srv/www/WWW
g+ws /srv/www/WWW
/srv/www/PRG
prg-admin /srv/www/PRG
g+ws /srv/www/PRG
Alternatively, we can use the usermod command to change the groups that the
users are in. The -G option sets a users groups.
Warning
usermods -G option sets the users groups. It does not add to
them. You must quote all the users groups. Any groups the user
was previously in that are not quoted will be lost by the user.
Suppose alice is in group alpha already. Then to add her to www-admin and prgadmin we must state that she is in all the groups.
# usermod -G alpha,www-admin,prg-admin alice
Note: The users will have to log in again to pick up the groups they have been added
to.
To let us know we have reached the right directory we will put a file, index.html in
each directory identifying it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>The DEPT web site</title>
</head><body>
<h1>Welcome to DEPT</h1>
<p>This is the DEPT web site.</p>
</body>
</html>
Now we must tell the web server to use these two directories appropriately. For this
we use the NameVirtualHost and VirtualHost commands.
NameVirtualHost *
<VirtualHost *>
ServerName
www.dept.cam.ac.uk
DocumentRoot
/srv/www/WWW
</VirtualHost>
<VirtualHost *>
ServerName
prg.dept.cam.ac.uk
DocumentRoot
/srv/www/PRG
</VirtualHost>
To set up a named-based virtual host we add a section like the one shown in the
figure above to the configuration file. Two such sections should be added, one for
www and one for prg. So what does it mean?
13
done
We are now running one web server supporting two web sites. However, if we request the index.html page from www.dept.cam.ac.uk then we get the source of the
homepage and not the HTML rendering of it. We still have work to do.
14
Before we find out why, for completeness we should cover the assorted options that
can be passed to the startup script beyond the start, restart and reload options
we have met already.
stop the web server and if this succeeds (i.e. if it was running before), start it
again.
status
Causes a running web server to reread its configuration file(s) and to reopen its
log files.
15
Does not launch a web sever but forces it to parse the configuration file for syntactic validity.
16
In particular note the Content-Type: header. This identifies the document served as
being of MIME content type text/html. This informs the browser that the document
should be parsed as HTML rather than as plain text. This identification of content
type is an important feature of HTTP that was lacking in many earlier transfer protocols.
Now lets look at the headers coming from our server as it currently stands.
HTTP/1.x 200 OK
Date: Wed, 21 Feb 2007 17:49:42 GMT
Server: Apache/2.2.3 (Linux/SUSE)
Last-Modified: Wed, 21 Feb 2007 17:34:30 GMT
Etag: "1c0e41-132-f8897580"
Accept-Ranges: bytes
Content-Length: 306
Keep-Alive: timeout=5, max=100
Connection: Keep-Alive
Content-Type: text/plain
The principal difference is that the Content-Type: header now reads text/plain.
17
The file /usr/share/misc/magic is used to store the information about how to map
from content to MIME type. The file /usr/share/misc/magic.mime is used for the
more verbose descriptions.
File name analysis
The other approach is to use the file name. In particular it is traditional that files
should have particular suffices according to their MIME content types. This is the
most commonly used approach.
This approach is taken by other utilities than just the web server and there is a system
wide file giving the correspondence between file names and MIME content types.
This file is /etc/mime.types which is part of the SLES base system (as part of the
aaa-base package).
application/msword
application/pdf
application/postscript
application/rtf
application/x-bzip2
application/x-dvi
application/xml
audio/mpeg
image/png
model/vrml
text/html
text/plain
video/mpeg
video/quicktime
doc
pdf
ai eps ps
rtf
bz2
dvi
mpga mp2 mp3
png
wrl vrml
html htm
asc txt
mpeg mpg mpe
qt mov
Apache is capable of both modes of operation. We will use the latter as it is more
common. This is for historical reasons and is not a reflection on the relative values of
the two mechanisms.
18
mime_module
/usr/lib/apache2/mod_mime.so
/etc/mime.types
The LoadModule command takes two arguments. The second is the filename of the
shared library that it needs. Its normally possible to quote the pathname of the module relative to Apaches ServerRoot, often /etc/apache2. But SLESs Apache is built
with an un-helpful ServerRoot of /srv/www so we have to use absolute pathnames
here. The first argument is the name of the module within that file. Normally you
need to consult the documentation to determine what a modules name is.
A list of all the common modules, together with their library file names, module
names and brief descriptions is given in Appendix A at the end of these notes.
The TypesConfig command indicates the file that has the correspondences between
file name suffixes and MIME content types.
So how does our web server work now? The pages are now presented as HTML.
Symbolic links
We can now see the index.html file as expected but if we create a symbolic link
called main.html to index.html and ask for that we get a failure.
$ cd /srv/www/WWW/
$ ln -s index.html main.html
$ ls -l
ls -l
total 4
-rw-r--r-- 1 root www-admin 306 2007-02-21 17:34 index.html
lrwxrwxrwx 1 root www-admin 10 2007-02-21 18:36 main.html -> index.html
When we try to access the symbolic link we get a 403 Forbidden error. The web
server has found the symbolic link but has decided not to follow it.
20
To instruct the web server to follow symbolic links we need to set an option. You will
recall we unset all options with Options None in the configuration file. Now we need
to turn on one of them.
We can do this with the command Options FollowSymLinks but this has a certain subtly we need to understand. The command Options FollowSymLinks sets
the FollowSymLinks option and unsets all of the others. The Options command followed by a list of options is absolute; precisely the options specified will be set and
no others. For this reason we will introduce the syntax for setting (and unsetting)
individual options while leaving the others unchanged.
Options
+FollowSymLinks
There is an analogous syntax with a minus sign for turning off options while leaving
others untouched.
21
Because symbolic links might be used to circumvent access controls in the web
server there is a modified version of this option with the rather unwieldy name
SymLinksIfOwnerMatch. This instructs the web server to follow the symbolic link if
and only if the symbolic links owner (typically the user who created it) and the
targets owner match.
It is worth mentioning that effects very similar to those provided by symlinks can also
be created using web server facilities by using the Alias command which we cover
later in the Section called Improving the listings in Chapter 6. Both have strengths and
weaknesses; using both at the same time can be a recipe for madness!
22
23
24
Note that we have a new command DirectoryIndex which is the only additional
command provided by dir_module. It is passed a list of the defaults to use if the
directory is looked for. If a directory is requested then the web server will look for
index.html in the directory because that filename is the first argument to the command. If index.html is missing then the server will look for index.htm, the second
quoted name. If neither is present then the web server will give a not found error.
Remember the server must reload its configuration to pick up these new instructions.
25
Basic listings
The relevant module is rather old and clunky, hailing back to the days when browsers
didnt support tables in HTML, but it is in very widespread use so we need to consider it. We will start by loading the module and removing dir_module (for simplicity
at this stage).
This is also the largest module (in terms of number of commands) we will cover in
this course. If you can cope with this one, you can cope with any of them.
LoadModule autoindex_module /usr/lib/apache2/mod_autoindex.so
If we just load the module then we see that, instead of getting a 404 Not found
error we get a 403 Forbidden error instead.
26
This can be confusing, because Forbidden is more commonly associated with access
control. In this case you are seeing it because the web server has been configured
to handle directories but by default wont do so. As with symbolic links above (see
Chapter 5) we need to set an option to instruct the module to do its job. Note that this
use of Options follows the loading of the module. Several options we will meet rely on
a specific module and their use must follow the LoadModule line in the configuration
file.
LoadModule autoindex_module /usr/lib/apache2/mod_autoindex.so
Options +Indexes
And now, if we ask for the / URL we get the list of the files and directories that appear
in the top-level directory. Weve included some additional files to make things more
interesting.
27
Next we will suppress certain rows from the listing. Why would we want to do
this? Well, suppose the web developers edit their files in place (i.e. in the directory
managed by the web server) with an editor (emacs, say) that while editing a file
(alpha.html, say) creates work files (#alpha.html#) while it is running and leaves
behind backup files (alpha.html~) when it is finished. We dont want these files appearing in the listings. We do this with the IndexIgnore command.
IndexIgnore "#*#"
"*~" ".*"
Note that the expressions to be ignored are placed in quotes. This is not typically
necessary but under certain circumstances it is required. In this case the # character
is the comment character in httpd.conf files. If it was not enclosed in quotes then
everything on the IndexIgnore line beyond the first # would be ignored.
28
Warning
Just because a file name is not in the listing does not mean that it
cannot be downloaded. If I see alpha.html and guess that there
might be an alpha.html~ I can still request it and the server
will serve it to me. We will deal with blocking these downloads in
the Section called Blocking access to files in Chapter 10.
In addition to having a listing of files, it is possible to place text above and below
the listing. This can either be in the form of plain text or full-blown HTML. We will
concentrate on the latter.
To add HTML above the listing the configuration must identify a header file. This file
must have a name that identifies it as having MIME content type text/html. In the
simple case, however, the files content, should not be a full HTML document but just
the HTML body component (without the leading BODY tag) for the text to appear
above the listing. Everything else will be automatically generated. We identify this
file (should it exist) with the HeaderName command.
HeaderName HEADER.html
Note that the HEADER.html file appears in the listing too. Typically this is not wanted
as it is already doing its job by having its contents appear at the top of the page.
The file HEADER.html would be a good candidate for the IndexIgnore command.
The next prettying up of the listing will be to add icons to the listing. Typically, icons
are used to represent the MIME content type of the file. We will use the icons in the
/usr/share/apache2/icons/ directory which are provided for this purpose.
We are immediately presented with a problem. The icons directory is not in either
web sites DocumentRoot. We could copy the directory or symlink to it, but in this
case we are going to introduce another facility: aliasing. This comes courtesy of the
alias_module module and its Alias command.
LoadModule alias_module /usr/lib/apache2/mod_alias.so
Alias /icons/ /usr/share/apache2/icons/
The Alias command overrides the DocumentRoot for specific URLs. In this case any
URL whose local part starts with /icons/ (n.b. the trailing slash) will be looked up
in /usr/share/apache2/icons/. If we place this directive before the definitions of
the virtual hosts then it will apply to both.
Once the module has been loaded, the Alias command may be run multiple times,
both inside and outside of the virtual host sections. If it appears within a virtual hosts
paragraph then it applies to just that virtual host.
The file icon.sheet.png in the icons directory gives a quick lookup of all the icons
provided. Now we have access to the icons we need to know how to make use of
them in directory listings. The auto-indexing module provides a slew of commands
for this purpose. The trick to producing self-consistent indexes is to use as few as
possible. We will set up distinct icons for the following entries.
Categories with distinct icons
PostScript
Subdirectories
The command that associates an icon with a MIME content type is AddIconByType.
However, we will also specify the ALT text for text-based browsers with the analogous AddAltByType command. While we are at it, we will supply a DefaultIcon to
use when nothing else matches.
AddIconByType
AddAltByType
AddIconByType
AddAltByType
AddIconByType
AddAltByType
AddIconByType
AddAltByType
AddIconByType
AddAltByType
AddIconByType
AddAltByType
AddIconByType
AddAltByType
AddIconByType
AddAltByType
/icons/layout.gif
"HTML file"
/icons/text.gif
"Plain text"
/icons/generic.gif
"Text"
/icons/image2.gif
"Static image"
/icons/sound1.gif
"Audio"
/icons/movie.gif
"Video"
/icons/ps.gif
"PostScript"
/icons/pdf.gif
"PDF"
DefaultIcon
/icons/ball.gray.gif
text/html
text/html
text/plain
text/plain
text/*
text/*
image/*
image/*
audio/*
audio/*
video/*
video/*
application/postscript
application/postscript
application/pdf
application/pdf
Note: The icons are supplied in GIF and PNG format. Normally I would recommend using
the PNG icons rather than the GIF ones since PNG is technically a better format and not
troubled by patent problems. However, whoever converted the GIFs to PNGs got the
background transparency wrong so you should use the GIF icons for the time being until
the PNGs are fixed.
We still have a problem with directories. There is no MIME content type for a directory so we must use other facilities. The following is a filthy hack introduced by
Apache version 1 and preserved into version 2.
AddIcon
AddAlt
AddIcon
AddAlt
/icons/dir.gif
"Directory"
/icons/back.gif
"Up"
"^^DIRECTORY^^"
"^^DIRECTORY^^"
".."
".."
Conclusion
And now our listings look a bit more colourful. But this is a lot of effort for limited
presentational value.
30
31
Turns on the four-column (by default) indexing mode rather than plain, bulletlist indexing mode.
HTMLTable (f)
This instructs Apache to use an HTML table rather than a <PRE> block to present
the listing.
33
34
Chapter 7. Logging
Error log
We will examine the error log to see what is logged and to change the amount of
logging done.
log_config_module
We will load and use a module that allows us to configure exactly what we log for
each request.
Log file rotation
We will illustrate the SLES system-wide mechanism for log rotation and briefly mention, and then discard, an Apache-specific way to do the same thing.
Legalities
There will be a brief description of the legal implications of keeping log files.
Our first example will be seen in the log files from this course more than any other
lines (we hope!). The line that starts Graceful restart requested is the logged
entry that means we requested a reload of the configuration file.
The line that (hopefully) follows it is the line from Apache that says it has been
(re)configured and that it is resuming normal operations, i.e. serving web pages
again.
[Thu Feb 22 15:13:35 2007] [notice] caught SIGTERM, shutting down
Chapter 7. Logging
[date]
[severity ]
message
We can change the level of the logging (of formatted messages) with the LogLevel
command. Either globally, or within specific virtual hosts sections we can issue the
command LogLevel debug, say, to get more debugging.
Level
Meaning
Example
emerg
alert
crit
error
A request on a single
request.
warn
Warnings.
notice
Purely informational
info
/var/www/WWW/nonesuch.html
debug
Debugging.
Messages issued from a running web server are well formatted. However, if you
make a syntax error in the httpd.conf file then the server wont launch and the
error message is rather more stark.
Syntax error on line 21 of /etc/apache2/httpd.conf:
Invalid directory indexing option
It is also possible to move the error log file, or to do without the file altogether (but
still log errors).
LogLevel info
ErrorLog /var/log/apache2/error.log
The ErrorLog directive gives the name of the error log file. If the file name given
is syslog then logging is not done to /var/log/apache2/syslog but rather all
error logs are passed to the operating systems system logger. This can be useful if
you arrange for your system logs to be transmitted off-machine to a central logging
engine which you want to receive Apache error logs too.
36
Chapter 7. Logging
Finally, if the file name starts with a pipe character, |, then what follows is interpreted
as a command which should be forked and executed and which has the error log lines
passed to it on its standard input.
Access logs
To date the only log file we have met is the error log. There is no logging in our
current server configuration when things arent going wrong. Probably we want to
log the requests that are made of our server. These are the access logs.
We need to decide what we want to log and where to log it to. We may want more
than one log file for different sets of data.
As (almost) ever, the means to get this functionality is to load a module:
log_config_module from mod_log_config.so.
This provides us with one particularly useful command: CustomLog. This allows us
to specify what information to record and where to record it for each query/response
at the server. This power comes at the price of almost complete syntactic obscurity at
first glance. But in all honesty its not that bad.
Suppose we wanted to record just the following information about each query processed by the server:
URL requested
LoadModule
CustomLog
log_config_module
logs/request.log
modules/mod_log_config.so
"%t %U %h %s"
Each of the elements beginning with a percentage character is called an escape code
and is converted into some piece of logged information. A complete list of the codes
is given in Appendix B.
37
Chapter 7. Logging
Notice how requests for the top-level directory are being logged as requests for
/index.html. It appears that apache applys at least some of its internal processing
to the value it loggs with %U, in this case using dir_module to locate a suitable
index document.
Problems with the output as it stands
The simplest way to address the issue of which website was queried is to move the
CustomLog lines into the virtual host sections and to have two different log files.
This gives them the flexibility to log different things too.
<VirtualHost *>
ServerName www.dept.cam.ac.uk
DocumentRoot /srv/www/WWW
CustomLog /var/log/apache2/www.log "%t %U %h %s"
</VirtualHost>
If we really wanted a single log file with the virtual host information we could use
the %v escape code to record it.
To enable the use of hostnames rather than addresses, we must arrange for
the web server to do DNS lookups for the IP addresses on each incoming
query. We will do this with the HostnameLookups command. This command
is a core Apache command and not part of the logging module. In some
circumstances, hostnames will be looked up even without this command. For
example if you do any access controls based on host names as we will be in
the Section called Access control based on client IP address in Chapter 10.
We
will
set this on globally. If either website wanted to record IP addresses rather than
hostnames then it can do so by using %s rather than %h.
38
Chapter 7. Logging
HostnameLookups On
39
Chapter 7. Logging
Named formats
A common requirement is for all virtual hosts to log in the same format. To assist
with this it is possible to name a format definition and to then refer to the formats
name in the CustomLog line.
LogFormat
clf
<VirtualHost *>
ServerName www.dept.cam.ac.uk
DocumentRoot /srv/www/WWW
CustomLog /var/log/apache2/www.log clf
</VirtualHost>
Logging headers
One very useful escape code is %{fubar }i which will log the value of incoming
header fubar . We could use this as %{Host}i to record the queried Host header, for
example, to check our virtual hosting was working as expected.
The values of incoming headers are used to define a common alternative to Common Log Format. This is called Combined Log Format since it combines the Access Log with the Referer and User Agent logs that were maintained in separate files
by early versions of Apache.
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
Log rotation
It is one thing to create logs; it is quite another to cope with them. A log file grows
without bound unless action is taken and this can cause problems.
Problems with growing log files
A solution to this generic problem of log file growth is log rotation. This involves the
regular (nightly or weekly, typically) moving of an existing log file to some other file
name and starting fresh with an empty log file. After a period the old log files get
thrown away.
Because this is a general issue, many Linux distributions (SLES included) include a
general solution that can be applied to any set of log files, not just the web servers.
40
Chapter 7. Logging
There is an Apache-specific solution (which is provided by the rotatelogs command)
but we will use SLESs generic solution, provided in the logrotate package.
Once each night the logrotate program reads in its configuration files telling it which
logs to rotate and how to do it. One of these files tells it to rotate Apaches log files.
The main configuration file sets up the defaults and then reads in a directory of instructions for specific sets of log files from the /etc/logrotate.d directory.
# see "man logrotate" for details
# rotate log files weekly
weekly
# keep 4 weeks worth of backlogs
rotate 4
# create new (empty) log files after rotating old ones
create
# uncomment this if you want your log files compressed
#compress
# uncomment these to switch compression to bzip2
compresscmd /usr/bin/bzip2
uncompresscmd /usr/bin/bunzip2
# former versions had to have the compresscommand set accordingly
#compressext .bz2
# RPM packages drop log rotation information into this directory
include /etc/logrotate.d
# no packages own wtmp -- well rotate them here
#/var/log/wtmp {
#
monthly
#
create 0664 root utmp
#
rotate 1
#}
# system-specific logs may be also be configured here.
/etc/logrotate.conf: commands
weekly
Each file should be rotated weekly. The log rotation job runs nightly, though, so
this can be changed to daily for a specific log file if desired.
The three commands that specify how often rotation should take place are daily,
weekly and monthly.
rotate 4
Keep four sets of log files. The comment is slightly inaccurate; four weeks worth
of logs will be kept if rotation is done weekly. If rotation is done daily then this
command means that four days worth of logs are kept.
create
After moving the main log file from logfile to logfile.1 a new, empty
logfile should be created.
41
Chapter 7. Logging
include /etc/logrotate.d
This command instructs the log rotation program to read in every file in this
directory. One of these files will correspond to the web servers log files.
The /etc/logrotate.d/apache2 file (part of the apache2 package, not the logrotate
package), contains the instructions specific to the web server logs.
/var/log/apache2/access_log {
compress
dateext
maxage 365
rotate 99
size=+4096k
notifempty
missingok
create 644 root root
postrotate
/etc/init.d/apache2 reload
endscript
}
/var/log/apache2/error_log {
compress
dateext
maxage 365
rotate 99
size=+1024k
notifempty
missingok
create 644 root root
postrotate
/etc/init.d/apache2 reload
endscript
}
/etc/logrotate.d/apache2: commands
/var/log/httpd/access_log { ... }
This specifies that the commands within the curly brackets are to be applied to
the access log. A similar block applies to the error log.
compress
Rotated log files should be compressed. Logfiles, which can be very large, typically compress very well.
dateext
Archive old versions of log files adding a date extension like YYYYMMDD to
the filename.
maxage 365
Remove rotated logs older than 365 days. The age is only checked if a logfile is
to be rotated.
rotate 99
Delete old log files once they have been rotated 99 times.
size=+4096k
Rotate the file if it becomes bigger than 4MB, even if it was last rotated less than
a week ago.
42
Chapter 7. Logging
notifempty
This command instructs the system not to rotate the logs if the current main log
file is empty. See the discussion below about whether this is a good idea or not.
missingok
This is the instruction not to return an error if a particular log file is not present.
create 644 root root
After rotation, create a new logfile owned by user root and group root and with
read/write permissions for its owner and read permissions for everyone else.
postrotate ... endscript
Following the rotation of a log file the commands between postrotate and endscript are run. This rotation program runs as root so care must be taken with the
commands that appear here.
/etc/init.d/apache2 reload
This instructs Apache to do a Graceful Restart in which the master web server
demon advises its children to exit after their current request and then re-reads
its configuration files and re-opens its log files.
There are two points which must be made about log rotation and changing its settings. These are to do with the presence of editor backup files and the Data Protection
Act (1998).
Backup files
The command include /etc/logrotate.d will read in almost every file in that directory.
So if you edit the file apache2 and leave behind both apache2 and apache2.old then
both these files will be included and your log files will have the log rotation process
applied twice. Now, because of the weekly (or monthly or daily) commands the
rotation shouldnt actually happen but it is still not certain that the right file will be
applied.
43
The principle of this chapter is to provide your users with the ability to create their
own web pages. The web pages may be located on the servers in question, or on a
different server altogether. As ever, there is a module that provides the extra functionality. In the example below, we provides user pages in all the virtual hosts.
LoadModule
UserDir
userdir_module /usr/lib/apache2/mod_userdir.so
public_html
Translated path
public_html
~bob/public_html/alpha/beta.html
www
~bob/www/alpha/beta.html
/var/www/users
/var/www/users/bob/alpha/beta.html
/var/www/*/web
/var/www/bob/web/alpha/beta.html
http://elsewhere/users
http://elsewhere/users/bob/alpha/beta.html
http://elsewhere/*/web
http://elsewhere/bob/web/alpha/beta.html
http://elsewhere/~*/
http://elsewhere/~bob/alpha/beta.html
It is possible to give a sequence of targets to the UserDir command. In this case they
will be searched in turn until one provides the server with the file or directory it is
looking for. Only the last entry in the list is allowed to be a redirection to another
server (i.e. a URL) because when the server reaches this one it sends back the redirection to the browser and never gets to discover if the file existed at the far end.
Note that the Apache user, wwwrun under SLES, must be able to read files if it is to
serve them. If it cant read the files in a users public_html directory then all this
isnt going to work.
44
45
We will start by noting how to change settings from within the httpd.conf file for
a directory tree. In our current configuration file the directory index file name is
index.html. Suppose for a subdirectory of one of our web sites we wanted to change
it to be main.html. How would we do that?
<VirtualHost *>
ServerName www.dept.cam.ac.uk
DocumentRoot /srv/www/WWW
CustomLog /var/log/apache2/www.log clf
<Directory /srv/www/WWW/bestiary>
DirectoryIndex main.html
</Directory>
</VirtualHost>
The <Directory dir > ... </Directory> identifies a series of commands which
should override or enhance the general settings for a specific subdirectory,
/var/www/WWW/bestiary in the example given in the figure.
46
In the case of commands we have met, it is easy to imagine simply issuing them again
within a <Directory> block to override the previous settings. But what about turning
features on or off? A common example is to turn on or off the automatic generation
of indexes.
At the moment we can see the index of the games directory in the
www.dept.cam.ac.uk web site.
47
And any future attempt to index games gives a 403, Forbidden, error.
48
main.html index.html
This puts the control of the files in the hands of the people who have access to the
directories.
Once configured, these files are searched for and read by Apache every time it accesses the directories in which they appear. This has the advantage that you dont
have to restart the web server to make changes to them visible (which is vital since
the people that use these files dont normally have the rights to restart Apache). The
downside is that Apache has to do more work to serve every request.
The AllowOverride command is rather unsatisfactory - it allows the controllers of
httpd.conf to stop the Options command being used in the AccessFileName files,
but not to specify which options can and cant be set. It can specify what you can do
with IndexOptions but not whether or not you can enable/disable indexes at all. It
has many limitations.
50
Two posibilities
Now we move to the topic of access control. There are fundamentally two ways of
doing this: by client location and client identity.
Client location involves specifying whether access is permitted based on the IP address or hostname of the client (i.e. browsing) system. When a request is received by
the server the IP address from which the request was received is known. This address, or the hostname associated with it in the DNS, is checked against a set of rules
to determine whether or not the request should be honoured.
Proxy servers
Client location security is often used within the University for restricting
access to an institution or to the University, loosely defined as anything in cam.ac.uk. This approach doesnt work but is often regarded
as good enough to keep happy the politicians, lawyers and other people who dont understand technology. From the point of view of the
web administrator it also has the advantage of simplicity. The reason
it doesnt work is that web proxies can forward a request from outside
Cambridge on to a server within Cambridge which sees the request
coming from within Cambridge and honours it. The Computing Service
has had its internal minutes cached on Google for the whole world to
read after a web proxy on the CS staff network went unnoticed.
51
External users
Its increasingly common for members of the University to use computers not connected to the University network - people with broadband at
home, people working from wireless networks while travelling, etc. In
some cases people use such connections almost exclusively and this
trend can be expected to increase. Security based on client location
denies these users access to information which they are intended to be
able to see.
Client identity involves challenging the user to quote some means of identifying him
or herself before permitting access to the document requested. This has the advantage of dealing with proxies, but the disadvantage of requiring administration of the
userids and passwords. A common compromise is to create a single userid and password for a set of pages and pass the pair on to anyone who needs access. This has the
disadvantage that you dont know which of your users read the pages, but often you
dont want to know.
To avoid the password administration problem, the Computing Service provides a
central authentication system that web administrators can use if the want. This allows members of the University to identify themselves using a centrally administered
user-id and password.
52
Match?
Initial
State
All requests refused.
Rule matches.
Access is allowed.
Deny from
trouble.cam.ac.uk
Rule matches.
Access is denied.
Final
Access is denied.
Note that the sequence of Allow and Deny commands is unimportant and that their
processing is entirely dependent on the Order.
The addresses given in the Allow and Deny statements can be specified in a variety
of ways. The examples given are for the Allow command but are equally applicable
to the Deny command.
We make the directory writable rather than just the individual files to make life easier
for programs that move files about within directories for backing up.
$ htpasswd2 -m /etc/apache2/access/passwd bob
New password: password
Re-type new password: password
Adding password for bob
$ cat /etc/apache2/access/passwd
bob:$apr1$kEDyP/..$n0DCjezTD.T.C.1s3td6..
htpasswds -m option causes the password file to use an MD5 password encoding for the password. This is better than the traditional (and default) crypt algorithm. This makes the password much harder to reverse engineer from the file but
all userid/password schemes are vulnerable to dictionary attacks and it is important
that the password file not be downloaded to make this attack much harder.
54
auth_basic_module
authn_file_module
authz_user_module
authz_user_module
/usr/lib/apache2/mod_auth_basic.so
/usr/lib/apache2/mod_authn_file.so
/usr/lib/apache2/mod_authz_user.so
/usr/lib/apache2/mod_authz_user.so
<Directory /srv/www/WWW/bestiary>
AuthType
Basic
AuthName
"Restricted area"
AuthUserFile /etc/apache2/access/passwd
Require
valid-user
</Directory>
55
Next we will consider other policies. We will assume that we have created three additional web userids: tom, dick and harry.
<Directory /srv/www/WWW/bestiary>
AuthType
Basic
AuthName
"Restricted area"
AuthUserFile /etc/apache2/access/passwd
Require
user bob tom
</Directory>
The Require user bob tom statement replaces the valid user policy with a one of
these users policy.
If you plan to use certain collections of users repeatedly for access control this scheme
can be taken further and groups of users can be defined. We can then specify that the
validated user be one of a series of groups.
First we must define our groups. We will create a groups file this time by hand because there are no tools analogous to htpasswd to manage the files for us.
managers:
workers:
bob tom
dick harry
We also need a module that knows about group files: authz_groupfile_module (in
versions of Apache before 2.2 this functionality was part of auth_module). We can
then change from a user list to a group list by specifying which group file to use and
which groups are permitted access.
LoadModule
authz_groupfile_module /usr/lib/apache2/mod_authz_groupfile.so
<Directory /srv/www/WWW/bestiary>
AuthType
Basic
AuthName
"Restricted area"
AuthUserFile /etc/apache2/access/passwd
AuthGroupFile /etc/apache2/access/group
Require
group managers
</Directory>
auth_digest_module
authn_file_module
authz_user_module
authz_groupfile_module
/usr/lib/apache2/mod_auth_digest.so
/usr/lib/apache2/mod_authn_file.so
/usr/lib/apache2/mod_authz_user.so
/usr/lib/apache2/mod_authz_groupfile.so
<Directory /srv/www/WWW/bestiary>
AuthType
Digest
AuthName
"Restricted area"
AuthDigestDomain /
AuthUserFile /etc/apache2/access/digest_passwd
AuthGroupFile /etc/apache2/access/group
Require
group managers
</Directory>
The password file is replaced with one with a different structure, but the group file is
the same as it was before.
$ touch /etc/apache2/access/digest_password
$ htdigest /etc/apache2/access/digest_password "Restricted area" bob
Adding user bob in realm Restricted area
New password: password
Re-type new password: password
The other issue we mentioned was that text files were used to hold the users, passwords and groups. For a small number of users this is fine but if your users reach into
the thousands you may want to consider alternatives that are faster to search. Alternatively, you may already have an LDAP authentication mechanism and want to use
that. A series of other modules exist for providing authentication with passwords
and groups held in other formats.
58
ucam_webauth_module is configured much like other authentication modules. It relied on the services of the standard authz_user_module for to control user access and
on authz_groupfile_module for group file support so you must load them as well.
ucam_webauth_module also needs a random string to validate cookies that it sets so
you must provide that as well.
LoadModule
LoadModule
authz_user_module
/usr/lib/apache2/mod_authz_user.so
authz_groupfile_module /usr/lib/apache2/mod_authz_groupfile.so
LoadModule
AACookieKey
AAKeyDir
ucam_webauth_module
/usr/lib/apache2/mod_ucam_webauth.so
"now is the time for all good chickens to be counted"
/etc/apache2/webauth_keys
<Directory /srv/www/WWW/bestiary>
AuthType
Ucam-WebAuth
AuthGroupFile /etc/apache2/access/group
Require
group managers
</Directory>
59
60
The two worlds of access control are joined by the Satisfy command. This has two
possible options: Any and All. Satisfy Any requires the request to satisfy either the
location requirement or the authentication requirement. Satisfy All would require it
to satisfy both.
"#*#"
"*~"
"configuration"
61
Its also possible to block access to whole directories and directory trees. For
example we dont want anyone to access any information outside /var/www/,
/usr/share/apache2/icons/ and /home/user/public_html. While the current
configuration only allows access to these directories, its possible that a mistake in
the future could mess this up. A better approach is to deny access to everything by
default and then to explicitly all access as required. While we are at it, well also turn
off Options and AllowOverride by default and only enable them as needed.
<Directory />
Order Allow,Deny
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /srv/www>
Order allow,deny
Allow from all
Options FollowSymlinks Indexes
AllowOverride All
</Directory>
<Directory /home/*/public_html>
Order Allow,Deny
Allow from all
Options Indexes
</Directory>
<Directory /usr/share/apache2/icons/>
Order Allow,Deny
Allow from all
Options Indexes
</Directory>
62
file
/usr/lib/apache2/mod_mime.so
/usr/lib/apache2/mod_dir.so
/usr/lib/apache2/mod_autoindex.so
/usr/lib/apache2/mod_alias.so
/usr/lib/apache2/mod_log_config.so
/usr/lib/apache2/mod_userdir.so
/usr/lib/apache2/mod_authz_host.so
/usr/lib/apache2/mod_authz_user.so
/usr/lib/apache2/mod_auth_basic.so
/usr/lib/apache2/mod_authn_file.so
/usr/lib/apache2/mod_authz_groupfile.so
/usr/lib/apache2/mod_ucam_webauth.so
/usr/lib/apache2/mod_setenvif.so
/usr/lib/apache2/mod_negotiation.so
# Deny-by-default
<Directory />
Order Allow,Deny
Deny from all
Options None
AllowOverride None
</Directory>
<Directory /srv/www>
Order allow,deny
Allow from all
63
/icons/ball.gray.gif
AddIcon
AddAlt
AddIcon
AddAlt
/icons/dir.gif
"Directory"
/icons/back.gif
"Up"
".."
text/html
text/html
text/plain
text/plain
text/*
text/*
image/*
image/*
audio/*
audio/*
video/*
video/*
application/postscript
application/postscript
application/pdf
application/pdf
"^^DIRECTORY^^"
"^^DIRECTORY^^"
".."
64
65
66
67
Module name
Description
mod_actions.so
actions_module
mod_alias.so
alias_module
mod_asis.so
asis_module
mod_auth_basic.so
auth_basic_module
mod_auth_digest.so
auth_digest_module
Similar to auth_basic_module
but instead of using a plain text
authentication scheme, it uses a
cryptographic one.
mod_authn_alias.so
authn_alias_module
mod_authn_anon.so
authn_anon_module
mod_authn_dbd.so
authn_dbd_module
mod_authn_dbm.so
authn_dbm_module
Allows authentication
front-ends such as
auth_digest_module and
auth_basic_module to
authenticate users by looking
up users in dbm password files.
Previously known
asauth_dbm_module.
mod_authn_default.so authn_default_module
68
Module name
Description
mod_authn_file.so
authn_file_module
Allows authentication
front-ends such as
auth_digest_module and
auth_basic_module to
authenticate users by looking
up users in plain text password
files. This function was
previously part of auth_module
and auth_digest_module.
mod_authnz_ldap.so
authnz_ldap_module
Allows authentication
front-ends such as
auth_basic_module to
authenticate users through an
ldap directory. Previously
known asauth_ldap_module.
mod_authz_dbm.so
authz_dbm_module
mod_authz_default.so authz_default_module
mod_authz_groupfile.so
authz_groupfile_module Group authorization using
authz_host_module
mod_authz_owner.so
authz_owner_module
mod_authz_user.so
authz_user_module
Provides authorization
capabilities so that
authenticated users can be
allowed or denied access to
portions of the web site. This
function was previously part of
auth_module.
mod_autoindex.so
autoindex_module
Automatically generates
directory listings.
mod_cache.so
mod_disk_cache.so
mod_mem_cache.so
cache_module
disk_cache_module
mem_cache_module
mod_cern_meta.so
cern_meta_module
mod_cgi.so
cgi_module
mod_cgid.so
cgid_module
mod_charset_lite.so
charset_lite_module
70
Library
Module name
Description
mod_dav.so
mod_dav_fs.so
mod_dav_lock.so
dav_module
dav_fs_module
dav_lock_module
mod_dbd.so
dbd_module
mod_deflate.so
deflate_module
mod_dir.so
dir_module
mod_dumpio.so
dumpio_module
mod_env.so
env_module
mod_expires.so
expires_module
mod_ext_filter.so
ext_filter_module
mod_file_cache.so
file_cache_module
mod_filter.so
filter_module
mod_headers.so
headers_module
mod_imagemap.so
imagemap_module
mod_include.so
include_module
Server-side includes.
mod_info.so
info_module
mod_ldap.so
ldap_module
mod_log_config.so
log_config_module
Configurable logging of
requests and reponses.
mod_log_forensic.so
log_forensic_module
mod_logio.so
logio_module
mod_mime.so
mime_module
mod_mime_magic.so
mime_magic_module
mod_negotiation.so
negotiation_module
Module name
Description
mod_proxy.so
proxy_module
mod_proxy_ajp.so
proxy_ajp_module
balancing.
mod_proxy_connect.so proxy_connect_module Lets a proxying server handle
CONNECT requests.
mod_proxy_ftp.so
proxy_ftp_module
mod_proxy_http.so
proxy_http_module
mod_rewrite.so
rewrite_module
mod_setenvif.so
setenvif_module
mod_speling.so
speling_module
mod_ssl.so
ssl_module
mod_status.so
status_module
mod_suexec.so
suexec_module
mod_unique_id.so
unique_id_module
mod_userdir.so
userdir_module
mod_usertrack.so
usertrack_module
Provision of cookies.
mod_version.so
version_module
Version dependent
configuration.
mod_vhost_alias.so
vhost_alias_module
A number of other modules are available in other SLES packages that depend on
the apache2 package. Typically the package is named after the library. These are not
supported or maintained by the Apache group. The truly brave may care to wander
through the SLES contributed package sets for packages of Apache modules that
arent provided by Fedora at all. caveat administrator.
71
72
Package
Library
Module name
mod_auth_kerb
mod_auth_kerb.so
kerb_auth_module
mod_auth_mysql
mod_auth_mysql.so
mysql_auth_module
mod_auth_pgsql
mod_auth_pgsql.so
auth_pgsql_module
mod_authz_svn
mod_authz_svn.so
authz_svn_module
mod_dav_svn
mod_dav_svn.so
dav_svn_module
mod_perl
mod_perl.so
perl_module
mod_python
mod_python.so
python_module
php
libphp4.so
php4_module
How to get % in the log line. Why would you want to?
%a
Client IP address
%A
%B
%b
%{fubar }C
%D
%{fubar }e
%f
The name of the file whose contents were ultimately served back
to the client.
%H
%{fubar }i
Value of the fubar header on the input query. See also %o below.
%l
%m
%{fubar }n
%{fubar }o
%p
%P
The process ID of the child that serviced the query. Typically only
of use for debugging and trouble-shooting.
%q
%r
%>s
%t
%{format}t
The time of the query in the format specified. See the manual
page for strftime for details of the format.
%T
The time taken to service the query in seconds. See %D above for
more accuracy.
%u
%U
%v
The server name for the virtual host that was given the query.
74
100
Continue
101
Switching protocols
200
OK
201
Created
202
Accepted
203
Nonauthoritative information
204
No content
205
Reset content
206
Partial content
300
Multiple choices
301
Moved permanently
302
Found
303
See other
304
Not modified
305
Use proxy
307
Temporary redirect
400
Bad request
401
Unauthorized
402
Payment required
403
Forbidden
404
Not found
405
406
Not acceptable
407
408
Request time-out
409
Conflict
410
Gone
411
Length required
412
Precondition failed
413
414
415
416
417
Expectation failed
500
501
Not implemented
502
Bad gateway
503
Service unavailable
504
505
75