NAME

tntnet.conf - configuration-file for tntnet (8)

DESCRIPTION

Tntnet is configured in the configuration-file tntnet.conf.
tntnet.conf contains configuration variables with parameters.
Each line in tntnet.conf is either empty, a comment starting with '#'
or a variable with 0 or more parameters.
The variablename and parameters are spearated by whitespace. A
parameter can be surrounded by quotation-marks (")or apostrophes (').
If the parameter is marked this way, it can contain whitespace itself -
even linefeeds. If the value itself needs to have the separator, the
character can be prepended by backslash, which disables the special
meaning of the character itself.
Examples:
Varname value
Defines a variable with the name Varname and the value value.
Varname2 value1 value2 "This is a value with whitespace
and newline and quotationsmark: \""
Defines a variable with 3 parameters.

CONFIGURATIONVARIABLES

This section describes the variables, used by Tntnet (8).
BufferSizebytes
Specifies the number of bytes sent in a single system-call. This does
not limit anything in application-level. It does not affect e.g.
savepoints or exception-handling. Component-output is collected
completely and then passed in chunks of BufferSize bytes to the
operating system.
The default value is 16384.
CompPathdirectory
CompPath specifies, where tntnet should search for webapplications.
Tntnet searches first in the current directory and then in each
directory, you specify here, until a library is found. You can repeat
the directive as many times as desired to add more entries. If it is
not found, the next MapUrl-entry is tried.
Example
CompPath /usr/local/lib/tntnet
CompPath /usr/local/share/tntnet
Chrootdirectory
Does a chroot(2)-system call on startup, which locks the process into
the directory at system-level.
Example
Chroot /var/tntnet
Daemon0|1
If this flag is set to 1, Tntnet forks at startup and terminates the
parent-process on successful initialization.
Dirdirectory
Changes the current working directory of the process on startup.
Example
Dir /var/tntnet
EnableCompressionyes|no
Specifies, if Tntnet should use gzip-compression at http-level. By
default Tntnet use compression. A http-client like a web browser can
send a header "Accept-Encoding", to tell Tntnet, that it would accept
compressed data. Tntnet then can decide, if it use compression. When
the body is complete, Tntnet tries to compress the body. If the data
can be compressed by more than 10%, Tntnet sends this compressed data.
With this flag, this feature can be turned off.
Compression slows down processing but reduces the network-load.
Normally the size of html-pages can be compressed by about 70%, while
Tntnet slows down by up to 30%.
Example
EnableCompression no
Groupunix-group
Changes the group under which tntnet answers requests.
Example
Group tntnet-group
includefilemask
Reads additional settings from the specified files. Filemask might
contain glob-characters, so that multiple files might be read. The
order is not specified.
Example
include /etc/tntnet.d/*.conf
KeepAliveTimeoutmilliseconds
Sets the timeout for keep-alive requests.
Tntnet tries to do keep-alive-requests wherever possible. This has the
effect, that tntnet can receive multiple requests within a single tcp-
connection. The connection times out after KeepAliveTimeout
milliseconds. The timeout defaults to 15000ms.
Example
KeepAliveTimeout 300000
KeepAliveMaxnumber
Sets the maximum number of request per tcp-connection. This defaults to
100.
Example
KeepAliveMax 10
Listenip[port]
Specifies, on which address tntnet waits for connections. There can be
more than one Listen-directives, in which case tntnet waits on every
address. If there is no Listen-directive tntnet listens on 0.0.0.0
port 80. ip might also be a hostname.
Example Listen 127.0.0.1 8000
ListenRetrynumber
On startup Tntnet calls listen on the specified port. When the
systemcall returns with an error, Tntnet tries again and fails after
the specified number of attempts.
The default number is 5.
Example
ListenRetry 10
ListenBacklognumber
The system-call listen(3p) needs a parameter backlog, which specifies,
how many pending connections the operating-system should queue before
it starts to ignore new request. The value is configurable here.
The default value is 16
Example
ListenBacklog 64
Loadwebapplication
Load specifies, which webapplications are preloaded on startup.
Normally webapplications are loaded as needed. The disadvantage is,
that tntnet does not check on startup, if a application is loadable at
all. With this directive startup fails, if the application is not
loadable.
Example
Load myapp
MapUrlurlcomponent-identifier[path-info{additional-arguments}]
Tells tntnet, which component should be called, when it receives a
http-request. url is a regular expression, which is tried against the
request-url. If it matches, the component-identifier is evaluated.
component-idetifier may contain backreferences to the url. By default
the url is passed as path-info to the component, but this can be
changed with a third parameter. Additional parameters can be passed to
the component and accessed through tnt::httpRequest::getArgs().
This variable can occur more than once and they are tried in the order
they are found in the configurationfile, until the regular expression
matches and the component does not return tnt::DECLINED. If no MapUrl-
directive is found, http-error 404 (not found) is sent.
Example
# maps html-pages to components in myapp.so; e.g. /foo.html calls
foo@myapp MapUrl /([^/.]+).html $1@myapp # maps jpeg-urls to myapp;
e.g. /foo.jpeg calls foo_jpg@myapp MapUrl
/([^/.]+).jpeg $1_jpg@myapp # maps /foo/bar.html to bar@foo MapUrl
/([^/.]+)/([^/.].html $2@$1
ExampleMapUrlMapCachesize
As described in MapUrl urls are mapped to components with regular
expressions. This is a quite expensive operation, while the number of
different urls used in a typical web application is small. Therefore
Tntnet has a simple cache, which stores mappings to prevent the need to
process the same regular expression multiple times. The size of this
cache is limited. After the size is exceeded the cache is simply
cleared. This clearing is logged with the message "clear url-map-
cache". If you have a application whit many different urls and you
often see this warning-message, you might want to increase the cache.
The default value is 8192.
Example
MapUrlMapCache 32768
MaxRequestSizenumber
This directive limits the size of the request. After number Bytes the
connection is just closed. This prevents denial-of-service-attacks
through long requests. Every request is read into memory, so it must
fit into it. Bear in mind, that if you use file-upload-fields a
request might be larger than just a few bytes. The value defaults to
0, which means, that there is no limit at all.
Example
MaxRequestSize 65536
MaxRequestTimeseconds
In daemon mode tntnet has a watchdog, which restarts tntnet when the
maximum request time is exceeded. This happens, when a request is in a
endless loop or otherwise hangs. Restarting tntnet looses all active
sessions and the currently running requests. Therefore the timeout
should be well long enough for the longes request.
The default value is 600 seconds, which is normally much longer than a
http request should run. If the Timeout is set to 0, the watchdog is
deactivated.
Example
MaxRequestTime 1200
MinThreadsnumber
Tntnet uses a dynamic pool of worker-threads, which wait for incoming
requests. MinThreads specifies, how many worker threads there have to
be. This defaults to 5.
Example
MinThreads 10
MinCompressSizenumber
Http-compression for replies smaller than this are not compressed at
all.
The default value for this is 1024.
Example
MinCompressSize 256
MaxThreadsnumber
Tntnet uses a dynamic pool of worker-threads, which wait for incoming
requests. MaxThreads limits the number of threads.
The default is 100.
Example
MaxThreads 200
PidFilefilename
When run in daemon-mode, tntnet writes the process-id of the monitor-
process to filename. When the monitor-process is deactivated, the pid
of the worker-process is written. This ensures, that sending a sigkill
to the the stored process-id stops tntnet.
Example
PidFile /var/run/tntnet.pid
PropertyFilefilename
This directive specifies the property-file, where logging is
configured.
Example
PropertyFile /etc/tntnet/tntnet.property
QueueSizenumber
Tntnet has a request-queue, where new requests wait for service. This
sets a maximum size of this queue, after wich new requests are not
accepted.
The default value is 1000.
Example
QueueSize 50
SessionTimeoutseconds
This sets the number of seconds without requests after which a sesssion
is erased.
The default value is 300 seconds.
Example
SessionTimeout 600
SocketReadTimeoutmilliseconds
A worker-thread waits for some milliseconds on incoming data. If there
is no data, the job is put into a queue and another thread waits with
poll(2) on incoming data on multiple sockets. The workerthreads are
freed and they can respond to other requests quickly. The default
value is 10 milliseconds, which is good for normal operation. A value
of 0 results in non-blocking read. If timeout is reached, this does
not mean, that the socket is closed. A small timeout reduces
contextswitches on slow connections.
Example
SocketReadTimeout 0
SocketWriteTimeoutmilliseconds
This defines the time, how long the workerthreads wait on write. If
the timeout is exceeded, the socket is closed and the browser might not
get all data. The default value is 10000 milliseconds.
Example
SocketWriteTimeout 20000
SslCertificatefile
Specifies the certificate-file for ssl-connections if not specified in
SslListen
SslKeyfile
Specifies the certificate-key for ssl-connections if not specified in
SslListen
SslListenip[port[ssl-certificate-file[ssl-key-file]]]
Specifies, on which ip and port tntnet waits for incoming ssl-
connections. Optionally a certificate- and key-file can be passed.
Example
SslListen 192.168.0.1 8443
ThreadStartDelaymsExample
ThreadStartDelay 1000
Userusername
Changes the user under which tntnet answers requests.
Example
User www-data
VMapUrlhosturlcomponent-identifier[path-info{additional-arguments}]
This is like MapUrl, but is specific for the virtual host. This rule
matches only if the host and the url matches against the specified
values. Both are regular-expressions, so one rule can also match
multiple hosts.
Example
# maps request for the host www1.tntnet.org to application1 VMapUrl
www1.tntnet.org /([^/.]+) $1@application1 # maps request for the
host www2.tntnet.org to application2 VMapUrl www2.tntnet.org
/([^/.]+) $1@application2 # maps all calls to port 8000 to myapp
VMapUrl .*:8000 /([^/.]+) $1@myapp