
Chapter 8. Users’ own web pages
userdir_module
We will introduce the relevant module and the single command it provides.
Simple use
We will start with the simplest provision of users’ personal web pages by loading the
module and using it in its simplest form.
Complex use
We will then give an example of how it can be used to redirect lookups to an entirely
different system.
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 quesion, or on a
different server altogether. As ever, there is a module that provides the extra func-
tionality. In the example below, we provides user pages in all the virtual hosts.
LoadModule userdir_module modules/mod_userdir.so
UserDir public_html
Figure 8-1. Loading and using the module
In this example, the command UserDir public_html causes any URL of
the form http://server/~bob/path/name.html to correspond to a file
~bob/public_html/path/name.html. (In this filename the expression “~bob”
means “the home directory of user bob” and is standard Unix notation. It is this that
the URL notation is based on.
The directory name public_html is not fixed and can be modified. Furthermore,
more complex mappings of username onto file name can be provided. Any instance
of “*” in the “directory name” will be replaced with the user’s ID.
If the directory name is actually a URL then, instead of the web server looking for
a local directory, it responds with an HTTP redirection, pointing the web client at a
new URL, typically on a different server.
Table 8-1. userdir_module lookups of http://server/~bob/alpha/beta.html
UserDir argument 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
63
Commenti su questo manuale