Basic Installation of Pegasus
目次- 0.1.0 Installing httpd and mon
- 0.2.0 Creating user "web"
- 0.3.0 Creating
/usr/web
- 0.4.0 Some system files
- 0.5.0
/sys/lib/httpd.conf
- 0.6.0
/lib/namespace.httpd
- 0.7.0
/sys/lib/httpd.rewrite
- 0.8.0 The directory where web content is really placed
- 0.9.0 Log files
- 0.10.0 Run Pegasus using "mon"
- 0.11.0 Confirm Pegasus does service
2006/08/24 renewed
2003/01/11 updated
Here I will explain how to install Pegasus with policies:
- experiment on fossil based terminal.
- you are the host owner with account name "bob".
- run in server mode.
- run as user "web".
Installing httpd and mon
- get
pegasus-2.2.tgz
- unpack
term% gunzip pegasus-2.2.tgz
term% tar -xf pegasus-2.2.tar
then a directory "pegasus-2.2
" will be created in the directory in which you executed "tar". Let this directory be "$pegasus
" in the explanation below.
- compile
term% cd $pegasus/httpd
term% mk lib
term% mk
- install
The default installation place is:
/usr/local/bin/386
Create the directory and execute:
term% mk install
term% cd $pegasus/mon term% mk install
Creating user "web"
Add a user "web" to "/adm/users
":web:web:web:bobwhere "bob" is your account name. You must execute
echo users | con /srv/fsconsto reflect the change to fossil.
You need not give password for user "web".
Creating /usr/web
The 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/webDon'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/doc 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/tmpwhere "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/weband then
term% chmod 770 /usr/web/etc/nonce term% chgrp web /usr/web/etc/nonce
Ntoe that:
- Don't set owner of these directory to be "web". Permit "others" to read and execute.
- Directory "
/usr/web/etc/nonce
" must be given full access permission to user "web".
- File tree under "
example/usr/web/
" is configured for CGI, therefore there are needless directories if you do not use CGI. However I think they are harmless.
- Don't place web content under "
/usr/web/doc
". This directory is something like a dish to which web content is dynamically bound.
Some system files
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.httpdNote 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.conf
Take 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.httpd
Take a look at "/lib/namespace.httpd
". The contents will bebind -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/procNot all will be required. And note that the line:
bind /sys/lib /usr/web/sys/libwill 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.rewrite
Suppose 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/wwwIf you do want to configure more complicated hosting service, look "
/sys/lib/httpd.rewrite
".
The directory where web content is really placed
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
".
Log files
Before invoking Pegasus, create log files.term% cd /sys/log term% touch http blacklist term% chmod 666 http blacklist term% chmod +a http blacklistYou 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.
Run Pegasus using "mon"
Executeterm% b=/usr/local/bin/$cputype term% $b/mon -du web $b/httpd -suMand confirm by "ps" command that "mon" and "httpd" is really running.
The process owner should be "bob" and "web" respectively.
Confirm Pegasus does service
Try to access using a browser and take a look at "/sys/log/http
".