Sample NSAPI configuration files

NSAPI configuration is held in an 'obj.conf' and 'magnus.conf' file. In addition, if your webserver runs as the root user, ZWS allows you to configure an alternative user and group that the NSAPI execution environment will use.

Three Netscape-like configuration files are required: 'obj.conf', 'mime.types' and 'magnus.conf'. These three files must be stored in a https-vserver name/config directory, by default $ZEUSHOME/ns-config/https-vserver name/config.

You can download default configuration files by using the links for the obj.conf, mime.types and magnus.conf templates in the NSAPI configuration page of a virtual server in your Zeus Administration Server. These should be used in preference to the examples displayed below.

Sample obj.conf file

# Sample obj.conf file
#
# $ZEUSHOME/ns-config/https-foo/config/obj.conf

Init fn="load-modules" funcs="myauth"
     shlib="/usr/local/nsapi/libs/auth.so"
        
Init fn="load-modules"
     funcs="myrewrite, mylog, mylog-open"
     shlib="/usr/local/nsapi/libs/util.so"

Init fn="mylog-open"
     logfile=/usr/local/auth/access.log

Init commands are run at startup. The first two commands import the function 'myauth' from the shared library 'auth.so', and 'myrewrite', 'mylog' and 'mylog-open' from 'util.so'.

The third command runs the function 'mylog-open' once at startup.

Note that iPlanet and SunONE servers require that Init functions are stored in the magnus.conf file.

Continuing the obj.conf file...

&lt'Object name="default">
AuthTrans fn=basic-auth auth-type="basic"
     userdb="/usr/local/auth/users.dat" userfn=myauth
 
NameTrans fn=myrewrite from=/somewhere/
     to=http://www.somewhere.else.com/
</Object>

<Object ppath="*/secure*">
PathCheck fn=require-auth realm="Secure Site"
     auth-type="basic" auth-user="(pete|joe|karen)" AddLog
     fn=mylog
</Object>

The first word of a command indicates the stage in the webserver's processing where the command should be executed.

All commands, other than Init commands, are grouped into 'objects'.

Commands in the 'default' object are run on every request. Additional 'objects' can be used to augment the default object. The easiest way to specify additional objects is to give them a path regexp which matches a full filesystem name.

Commands are one line long, but any line beginning with whitespace (space or tab) is taken to be a continuation of the previous line.

Note: this sample obj.conf supposes the user has created or acquired NSAPI libraries auth.so and utils.so containing the appropriate functions.

Sample mime.types file

# Supplementary mime types for NSAPI
#
# $ZEUSHOME/ns-config/https-foo/config/mime.types

type=image/gif  exts=gif
type=text/html  exts=log,dat

These mime types override the Zeus mime-typer.

Sample magnus.conf file

# Default Zeus magnus.conf
#
# $ZEUSHOME/ns-config/https-foo/config/magnus.conf

LoadObjects obj.conf

'LoadObjects' provides the name of the obj.conf file. All other tags in this file are ignored.

Content Manager [Administrator] 16 December 2005  Permalink  
Download Free Trial

Recent Articles

Other Resources



www.zeus.com