![]() |
![]() |
/usr/web
/sys/lib/httpd.conf
/lib/namespace.httpd
/sys/lib/httpd.rewrite
2007/09/05 update
2007/04/04 update
2006/08/24 renew
2003/01/11 update
Here I will explain how to install Pegasus with policies:
term% gunzip pegasus-2.4.tgz
term% tar -xf pegasus-2.4.tar
then a directory "pegasus-2.4" will be created in the directory in which you executed "tar". Let this directory be "$pegasus" in the explanation below. term% cd $pegasus/httpd
term% mk lib
term% mk
/usr/local/bin/386
Create the directory and execute: term% mk install
In the same way, you can install "mon".
term% cd $pegasus/mon
term% mk install
Add a user "web" to "/adm/users":
web:web:web:bob
where "bob" is your account name. You must execute
echo users -r /active/adm/users >> /srv/fscons
to reflect the change to fossil.
You need not give password for user "web".
/usr/webThe directory "/usr/web" is a default base directory on which Pegasus configures namespace.( You can use other directory. Look "/sys/lib/httpd.conf".)
term% mkdir /usr/web
term% chmod 775 /usr/web
Don't let owner of "/usr/web/" be "web".
Create directories under "/usr/web/". The goal is like the followings*.
d-rwxrwxr-x bob bob ..... /usr/web/bin/386 d-rwxrwxr-x bob bob ..... /usr/web/bin/rc d-rwxrwxr-x bob bob ..... /usr/web/dev d-rwxrwxr-x bob bob ..... /usr/web/env d-rwxrwxr-x bob bob ..... /usr/web/etc d-rwxrwx--- bob web ..... /usr/web/etc/nonce d-rwxrwxr-x bob bob ..... /usr/web/lib d-rwxrwxr-x bob bob ..... /usr/web/mnt d-rwxrwxr-x bob bob ..... /usr/web/proc d-rwxrwxr-x bob bob ..... /usr/web/rc/lib d-rwxrwxr-x bob bob ..... /usr/web/sys/lib d-rwxr-xr-x bob bob ..... /usr/web/tmp
where "bob" is your account name. Take notice of the permission bits and the group of "/usr/web/etc/nonce/".
You have the replica under "$pegasus/example/usr/web/". Therefore you may copy the replica to "/usr/web". The copy is easy if you use my tool "cpdir". You can get "cpdir" from http://plan9.aichi-u.ac.jp/netlib/cmd/.
term% cpdir -mv $pegasus/example/usr/web /usr/web
and then
term% chmod 770 /usr/web/etc/nonce
term% chgrp web /usr/web/etc/nonce
Ntoe that:
/usr/web/etc/nonce" must be given full access permission to user "web".example/usr/web/" is configured for CGI, therefore there are needless directories if you do not use CGI. However I think they are harmless.Pegasus uses some files in system directories. The templates are in "$pegasus/sample". Copy them to the appropriate place:
term% cd $pegasus/sample
term% cp sys/lib/httpd.conf /sys/lib/httpd.conf
term% cp sys/lib/httpd.rewrite /sys/lib/httpd.rewrite
term% cp lib/namespace.httpd /lib/namespace.httpd
Note that you have already "/sys/lib/httpd.rewrite" and "/lib/namespace.httpd" of official httpd. It is wise to make a backup of these files.
/sys/lib/httpd.confTake a look at "/sys/lib/httpd.conf". You need not change the default values in this file. The tuning is after you have monitored the performance of the server.
/lib/namespace.httpdTake a look at "/lib/namespace.httpd". The contents will be
bind -a /usr/web/bin/$cputype /bin bind -a /usr/web/bin/rc /bin bind /sys/lib /usr/web/sys/lib bind /lib /usr/web/lib bind /bin /usr/web/bin bind /rc/lib /usr/web/rc/lib bind -c #e /usr/web/env bind #c /usr/web/dev bind /proc /usr/web/proc
Not all will be required. And note that the line:
bind /sys/lib /usr/web/sys/lib
will make all files under "/sys/lib" accessible via CGI. Especially you should note that some secret files such as "/sys/lib/ssh" and "/sys/lib/tls" might be there.
CGI environment configured in "/lib/namespace.httpd" will be inherited to real host, virtual hosts, and regular users. Therefore you should be careful enough.
Although the content is configured for CGI and the content might be too much for regular CGI service, I think the configuration is harmless.
/sys/lib/httpd.rewriteSuppose you are bob who administrates real host documents, and you want to locate documents under "/usr/bob/www/doc". Then the following single line is enough for most cases.
/ */usr/bob/www
If you do want to configure more complicated hosting service, look "/sys/lib/httpd.rewrite".
Web content of real or virtual host is placed under your home directory. If you are "bob" and configured your httpd root at "/usr/bob/www/", then
/usr/bob/www/doc/
is the directory.
Put a file "index.html" to this directory. You will find the sample in "$pegasus/sample/usr/bob/www/doc/index.html".
Before invoking Pegasus, create log files.
term% cd /sys/log
term% touch http blacklist
term% chmod 666 http blacklist
term% chmod +a http blacklist
You might fail to create log files. Appropriate privilege will be required.
If you feel inconvenience to become user "sys", try my tool "su" that works like UNIX "su" command.
Execute
term% b=/usr/local/bin/$cputype
term% $b/mon -du web $b/httpd -suM
and confirm by "ps" command that "mon" and "httpd" is really running.
The process owner should be "bob" and "web" respectively.
Try to access using a browser and take a look at "/sys/log/http".
You might find "pegasus-2.4a", "pegasus-2.4b", ... in
http://plan9.aichi-u.ac.jp/netlib/pegasus/
Those are bug fix versions to Pegasus 2.4.
Only updated components for ver.2.4 are there.