#!/bin/rc switch($1){ case this peep $0 exit case namespace.httpd peep $namespace exit case namespace_80 peep /etc/namespace_80 exit case * ; } cat<<-eof-
Kenji Arisawa Aichi University |
![]() |
Pegasus is running on Plan9 and Plan9 supports per process name space. Pegasus provides a per user name space for httpd service using this Plan9 power. I will show you in this page what is "per user name space".
I mean by the word "user":
$$home/web/doc
pegasus.aichi-u.ac.jp
is one of virtual hosts of this/sys/lib/httpd.rewrite
: http://pegasus */usr/pegasus/www
Then their web pages will be placed under /usr/pegasus/www/doc
bob
be the host owner, then the web directory will be defined in /sys/lib/httpd.rewrite
: / */usr/bob/www
and the web pages will be placed under /usr/bob/www/doc
.First of all, I would like to notice you that this is a CGI program of Pegasus.
You can look the code; click
The following is the output of
ls -l /
-eof- ls -l / cat<<-eof-
This name space is configured in the file:
and
where $$web
is a directory that is given to each user and is seen as /
in httpd name space.
Basic configuration will be done in /lib/namespace.httpd
by server administrator but each user can add his/her files to them using
$$web/etc/namespace_80
.
Directories $$web/doc
, $$web/bin
and $$web/etc
in are very special.They are provide by the user.Each user has these directories and they are hided from other users. (Even if these direcories have already provided by system administrator, they are replaced by users one.)
Directory $$web/doc
is the document root of each user, and some files in $$web/etc
controls access or redirects the request to his/her web page.
You can observe:
/doc
in the output. This is a document root of our users that is originally $$web/doc
. Let's look directories under the document root.
ls -l /doc
The output is:
-eof- ls -l /doc cat<<-eof-
Note that real place of them are /usr/pegasus/www/doc
There are some other home pages that are managed or administrated by other users in our server. All of their document root have the same name
/doc
in service space. However you can't see them in this name space. They are hidden! This is a power of Plan9/Pegasus.
Pegasus permits for each user to have his/her own direcory outside of document space. The name is $$web/etc
and $$web/bin
.
In $$web/etc
user can have some files such as passwd
, allow
and rewrite
to control accesses or redirect requests to his/her web pages.
In $$web/bin
user can have his/her executable files for service.
-eof- ls -l /etc cat<<-eof-
Directories that is seen in the root directory is mainly provide by the server administrator. You can see how it is organized in /lib/namespace.httpd
. Users can add some directories to them. You can see the example in the above output.
The name of directories that you have seen using ls -l /
came from /usr/web/
. Most of the directories in /usr/web/*
are empty. The contents are mainly defined in /lib/namespace.httpd
.
Files under /doc
and /etc
are those of /usr/pegasus. You will see exactly same files as:
/usr/pegasus/www/doc
and
/usr/pegasus/www/etc
Files in /bin
are mixture of files provided in /lib/namespace.httpd
and files provided in /usr/pegasus/www/etc/namespace_80
.
Note that virtual host pegasus is merely one of users of this server. You will see similar result for other users.
Home page in Pegasus can be classified in three categories:
Basic name space of these page is organized in /lib/namespace.httpd
. The real document root can be located anywhere.
Home page of virtual host is assigned in /sys/lib/httpd.rewrite
. This file defines the rule to translate URI to URI so that the server can redirect the request from the clients.
You can find the line in the file:
http://pegasus */usr/pegasus
The line with *
in the beginning of second field is special. Such a line defines the location of directory for virtual host.
User's home directory in URI is conventionally expressed like:
/~alice
where alice
stands for any user of httpd server. A user who has a directory $$home/web/doc
can have his/her home page. The directory automatically becomes a home page without any configuration in system file such as
/lib/namespace.httpd
nor /sys/lib/httpd.rewrite
.
Thus, user alice
who has:
/usr/alice/web/doc/index.html
have her home page, and the page will be seen as
/doc/index.html
in the name space of http service