Configuration

plexus

plexus [-c config] [-d topdir] [-i | -I sockfd] [-l log] [-p port] [-P pidfile] [-D diag]

  -p port         Specify port to open (/etc/service name or number)
                  Without -i or -I plexus will start in daemon mode,
                  [-p port] is only useful in this mode.

  -d topdir       Override default directory (/usr/local/www)
  -c config       Override default config file (server/plexus.conf)
  -l log          Override default log file (log)
  -P pidfile      Override default pid output file (plexus.pid)
  -D diag         Specify diagnosic output file (enable debug)

  -i              Use stdin/stdout (e.g., running under inetd)
  -I sockfd       Use specified socket (mostly for server restarts)
Plexus contains the main loop that accepts incoming HTTP connections and forks a process to handle the transaction. The main server can continue to accept other connections while the child processes the request in the background. The child vectors though the associative array %method, defined in plexus.conf, to one of the method routines (e.g., GET is handled by &do_get).

If started as a normal user, the default port is $http_userport and is defined in plexus.conf. It can be changed on the command line using the -p option. When started as root, it will open the standard HTTP port which defaults to $http_defaultport from plexus.conf. However, the port assignment can be overridden either on the command line using the -p option or in /etc/services by adding a line for the http protocol e.g.: http 80/tcp. Command line options always override internal defaults.

Topdir defaults to /usr/local/www, the config file defaults to server/plexus.conf, and the log file defaults to log.

Plexus also assumes that perl lives in /usr/bin/perl. If this is not the case then it's best if you create a symlink for it. If you can't do that then you will need to edit a bunch of files. To get the list run find . -type f -print | xargs grep -l /usr/bin/perl from the top level Plexus source directory.

site.pl

One of the first things you need to do is configure the site.pl file. This file contains all the platform-dependant code. It helps if you have installed your standard system header files using perl's h2ph. The only config option in local.conf that affects this file is locking, which is set in local.conf. It should be set to either flock or fcntl; the default is flock.

plexus.conf

Next, you should make sure all the settings in plexus.conf agree with your local system configuration. There shouldn't be much need to change this file unless you are adding new features. The notable exceptions are $http_chroot, which controls whether or not to chroot to the top of the tree; $http_user and $http_group which define the user and group to switch to if started as root; and $hostname, which should contain your fully qualified domain name (it defaults to /bin/hostname).

local.conf

Contains settings for various system parameters including: which files to load, directory mapping, format translations, and file-extension-to-content-type mappings. This file is not a perl script. It is designed for ease of use and flexibility.

Verification

After you install the files, test the server from the command line using the following command: /usr/local/www/server/plexus -i -l /dev/tty -D /dev/tty. This will log all information to your tty. You can type your request directly from the keyboard (e.g., GET / HTTP/1.0).

Finally, run plexus in server mode using the following command: /usr/local/www/server/plexus -D /dev/tty &. Once plexus is running, test it using your browser. If you run plexus as root, it opens port 80; if you are running it as a normal user, it opens port 8001.


Tony Sanders