The GwebS standalone server eliminates the need for a World Wide Web server, because it contains a small web server itself. Except for this, Gweb works identically in both modes (Stand-alone and as a CGI program). However, as it is a separate server, it needs configuration on how it should operate, which port to listen on, and so on.
The configuration file for gwebs is called gwebs.XXX
and
resides in the /usr/gar/config/default
directory on Unix
platforms, and C:\gar\config\default
on Windows NT. The XXX
part, called the "mode ID", is by default "DEF", but different
configuration files can be selected using a parameter to gwebs, where
"gwebs -mi ibm"
instructs GwebS to use a configuration file
calles gwebs.ibm
.
An installation of Gweb will write a file called gwebs.def
in
the configuration directory, but this should serve as an example only. Please
modify this file with a normal text editor to suit your needs.
When you have created the configuration file, Gweb can be launched with the following parameters:
gwebs [-mi XXX] [-dbg|-trace N] [-lp N] [-nb [off]|-na nnn.nnn.nnn.nnn ... [-nat nnn.nnn.nnn.nnn]] [-q] [-pid PIDFILENAME] (Unix only)
Instead of gwebs
the command could be gwebss
, in
which case the secure (SSL) version of the server is started. See the
separate GwebS SSL documentation.
The -nb
and -na nnn.nnn.nnn.nnn
parameters instruct the Gweb server to report statistics and load balancing
information to Gproxy. With -nb
(default
on), load balancing information will be broadcasted to
all Gproxy systems on the current subnet. With -na
, this
information will be sent to Gproxy on the IP address(es) given as a
parameter. Up to four IP addresses can be supplied, separated by a space.
Please consult the Gproxy manual for details on load balancing Gweb
servers.
The -nat nnn.nnn.nnn.nnn
parameter defines the IP
address to report for itself to Gproxy. This parameter is only needed when
GwebS and Gproxy is located inside a router doing Network Address Translation
(NAT), and supplies the IP address that should be visible to client systems
on the outside.
The -trace N
parameter defines a trace level for all sessions
started via this server. The -dbg
parameter is equivalent to
-trace 9
.
The -lp N
parameter defines the TCP/IP port number or service name GwebS should listen on. The default port number is 80 for non-SSL connections and 443 for SSL connections; the service names are "http"
and "https"
respectively. If specified on the command line, the -lp
parameter overrides any port setting in the GwebS configuration file (see below).
The two latter parameters are for the Unix version only:
-q
starts gwebs in Quiet mode (nothing is displayed on stdout),
and -pid PIDFILENAME
causes the parent pid of the process to be
written in the file PIDFILENAME. This makes it easier to terminate the
server, with for example the command "kill `cat PIDFILENAME`"
.
On Windows NT, a dialog box will appear (unless the program is run as a service) where some statistics are updated, and there is a button for terminating the server. On Unix, the program will make itself a background process. In both cases, you can shut down GwebS using the G&R products Gmanager and/or Gmonitor.
GwebS will write to a log file and (depending on configuration) an access
log file. These files are stored in the servers directory,
which is /usr/gar/servers/XXXX.gwb
directory on Unix platforms,
and C:\gar\servers\XXXX.gwb
on Windows NT. The XXXX part
corresponds to your node's DSA name, as configured in the
dsa.cfg
configuration files. If you do not have configured a DSA
name, Gweb will use the word "gweb"
instead.
Below is a list of all configuration directives you can use in the GwebS configuration file. Any line not starting with an alphabetic character [A-Z, a-z] is considered a comment line.
This defines the TCP/IP port GwebS listens for connections on. Default value is the standard HTTP port, 80. You can also specify the service name, e.g. Port http
or Port https
. Note that some systems require you to run with supervisor priviledges if you want to use a port number below 1024.
This defines the TCP/IP address GwebS listens for connections on. The default setting is that GwebS listens on all interfaces on the machine. You may want to use this directive in multi-homed environments in order to control which web server corresponds to different IP addresses. Either a dotted quad-type address or a DNS resolvable host name must be specified.
This is the host name to use for self-referencing URLs. In some circumstances, the server needs to send redirect instructions back to your browser, and this redirect must contain a complete URL.
Default value: http://ip-address[:port]
.
Some browsers use either the 1.1 version of the HTTP protocol, or use a
beefed-up 1.0 protocol, and automatically sends the Host: xxx
request header. If this is the case, Gweb will use this host name instead of
the IP address.
This directive defines the WWW content type for files which various file extensions. You may override the defaults, and extend the table, with your own settings. The default values are:
Content-Type text/xml xml Content-Type text/plain txt Content-Type text/plain text Content-Type text/html htm Content-Type text/html html Content-Type image/gif gif Content-Type image/png png Content-Type image/jpeg jpg Content-Type image/jpeg jpeg Content-Type image/jpeg jpe Content-Type video/mpeg mpg Content-Type video/mpeg mpeg Content-Type video/mpeg mpe Content-Type video/avi avi Content-Type video/x-ms-wmv wmv Content-Type text/vnd.wap.wml wml Content-Type image/vnd.wap.wbmp wbmp Content-Type application/x-glink glink Content-Type application/x-javascript js Content-Type application/x-java-jnlp-file jnlp Content-Type text/x-server-parsed-html ssi Content-Type text/x-server-parsed-html shtml
Any file with an extension not defined in a Content-Type statement will be
tagged with the MIME type application/octet-stream
.
There is a special Content Type to be used for designating CGI scripts.
This directive controls the generation of a Webserver-like log file. The format, Common Log Format (CLF), is exactly the same as used on all major web servers, which means that it can be used with standard Web server log analysis tools.
The CLF file is called access.XXX
(where XXX is the server's
mode id) and contains one separate line for each request. A line is composed
of several tokens separated by spaces:
host ident authuser date request status bytes
The Extended CLF (also called the NCSA combined format) has two more fields at the end:
referer user-agent
If a token does not have a value then it is represented by a hyphen (-). The meanings and values of these tokens are as follows:
date = [day/month/year:hour:minute:second zone]
day = 2*digit
month = 3*letter
year = 4*digit
hour = 2*digit
minute = 2*digit
second = 2*digit
zone = +' |-') 4*digit
"
).
This directive contains the name of a default file that the web server should give you if you requested a directory. You can specify multiple entries here; for example:
Index index.htm Index index.html
If you request a directory (like http://gweb.gar.no/
),
then Gwebs will first look for a file called
http://gweb.gar.no/index.htm
, then for
http://gweb.gar.no/index.html
, then -- if none of these exist --
send you an error message.
This section describes the mapping between a request for a virtual path (a URL) and of the following:
gweb
.
server-status
.
cgi
followed by the physical location of the CGI program.
web8
or TDS-Web
.
The Physical-part represents the replacement part of the Virtual path. Example:
Alias / U:\www\docs\ (Windows NT) Alias / \\machine\share\docs\ (Windows NT) Alias / /share/www/docs/ (Unix) Alias /xxx http://www.domain.com/ (external redirect)
Here, a request to anything starting with a slash is mapped to a local
file according to the rule above. Since this is effectively a catch-all, you
would probably want to define this directive as the last one. In the example
above, a request for http://your.host.name/gweb/config.htm
results in that the file in the table below is sent to the browser:
U:\www\docs\gweb\config.html \\machine\share\docs\gweb\config.html /share/www/docs/gweb\config.html
If the file does not exist, an error message (HTTP error code 404) will of course be returned.
The last format causes any request for something that starts with
/xxx
to result in a redirection to an external url,
http://www.domain.com/
.
The Virtual-part represents the location in the name space where
you want Gweb to be visible. You would probably want to have something like
/cgi-bin/gweb
here, since this is the default location for CGI
programs. However, since GwebS in itself does not use the CGI technique, you
can use any valid value here. The Physical-path is the key word
gweb
. Whenever GwebS receives a request that begins with
/cgi-bin/gweb
, control is transferred to the Gweb
facelifter.
The Virtual-part represents the location in the name space where you want the status screen to be visible. You could for example use /server-status
here. The Physical-path is the key word server-status
. Whenever GwebS receives a request that begins with /server-status
, control is transferred to the Gweb status screen.
The Virtual-part represents the location in the name space where
you want Web8 or TDS-Web to handle the request. The Physical-path is
the keyword web8
or TDS-Web
, then a space, followed
by a string used as a session name.
If no session name is given, Gweb assumes a session name equal to "node.application" (see below).
The Virtual-part syntax is always
/node.application
where the node
and application
is information
that your DPS 8000 department must give you.
Whenever GwebS receives a request that begins with
/node.application
, control is transferred to the Web8 susbsystem
handler.
The Virtual-part represents the location in the name space from where you want to execute a CGI program.
The Physical-path is the key word cgi
, then a space,
followed by the full path to the CGI program itself (and any program
parameters it might require). If the named program does not include a full
path, GwebS assumes that the CGI program resides in the same directory as the
one containing the gwebs
executable.
Whenever GwebS receives a request starting with Virtual-part, it starts the program named in Physical-path (including any parameters), sets up the environment for the program as defined in the CGI standard, sets the standard input to the CGI program to the TCP/IP data stream from the browser, and sends the program's standard output to the browser.
Note that you can also define CGI programs by its extension. For example, if you define a special Content-type named
Content-Type script/cgi .cgi .exe
all requested files with the given file name extensions are treated as CGI programs.
The Virtual-part represents the location in the name space that you you want to protect with a password.
The username:password text is a username and password pair (delimited by a single colon) that protects the virtual-part in question.
The Realm text is the prompt displayed to the user if you browse to a located protected by this password mechanism.
Note that neither the username nor the password can contain spaces. There may be multiple password settings for the same Virtual-part, but only the first Realm prompt defined will be used.
*** gwebs.def configuration file for web host "gweb.gar.no" Host http://gweb.gar.no Port http Logging extended Alias /server-status server-status Alias /cgi-bin/gweb gweb Alias /cgi-bin/nph-push cgi nph-push Alias /ph14.gartest web8 browser Alias /glinkj http://www.gar.no/glinkj Alias / ../../html/ Password /server-status username:password Administrator Credentials Index index.htm
There are some extra parameters that control the performance of GwebS. In normal situations you should not need to adjust any of these values, but in some circumstances you might need to define in a more explicit way how GwebS operates.
These parameters can be defined both in the gwebs.def
configuration file and on the command line. Command line parameters override
configuration file parameters.
Cmdline | Config file | Default | Description |
---|---|---|---|
-minidle | MinIdleServers | 4 | This directive defines the minimum number of server tasks (threads) waiting for a connection. GwebS will automatically create new server tasks if there are too few idle ones, in order to be prepared for new connections. |
-maxidle | MaxIdleServers | 10 | This directive defines the maximum number of server tasks (threads) waiting for a connection. GwebS will automatically terminate some server tasks if there are too many idle ones. |
-minrun | MinRunningServers | 4 | This directive defines the absolute minimum number of server tasks (threads). GwebS will never run with fewer tasks than this. |
-maxrun | MaxRunningServers | 200 | This directive defines the absolute maximum number of server tasks (threads). GwebS will never use more tasks than this. |
-maxreq | MaxRequestsPerChild | 0 | This directive defines the maximum number of browser requests a given server task can handle. The default of zero means that the server task is allowed to operate as many requests as needed. If you define a number her, the server task will automatically terminate. As an affect, GwebS will probably create a new task, depending on the parameters above. |
Use the server-status
mechanism described above to see
details about the GwebS server tasks.