Vous êtes sur la page 1sur 14

Tntnet configuration-reference

Author: Tommi Mkitalo Date: 2010-06-21 For Tntnet version 2.0

Tntnet configuration guide

Table of contents
AccessLog...........................................................................................................3 BufferSize...........................................................................................................3 CompLifetime......................................................................................................3 CompPath............................................................................................................3 Chroot.................................................................................................................4 Daemon...............................................................................................................4 DefaultContentT pe............................................................................................4 Dir.......................................................................................................................! "na#leCompression............................................................................................! $roup..................................................................................................................! include.................................................................................................................! %eepAli&eTimeout...............................................................................................' %eepAli&e(a).....................................................................................................' Listen..................................................................................................................' Listen*etr ..........................................................................................................+ ListenBac,log......................................................................................................+ Load....................................................................................................................+ (ap-rl................................................................................................................. (a)-rl(apCache................................................................................................ (a)*e/uestSize..................................................................................................0 (a)-rl(apCache...............................................................................................0 (imeD#...............................................................................................................0 (inCompressSize.............................................................................................11 (inThreads.......................................................................................................11 (a)Threads......................................................................................................11 2oCloseStdout..................................................................................................11 2o(onitor.........................................................................................................11 Pid3ile...............................................................................................................11 Propert 3ile......................................................................................................11 4ueueSize.........................................................................................................15 SessionTimeouot...............................................................................................15 Soc,et*eadTimeout..........................................................................................15 Soc,et6riteTimeout.........................................................................................13 SslListen............................................................................................................13 ThreadStartDela ..............................................................................................13 -ser...................................................................................................................13 7(ap-rl............................................................................................................14

Tntnet configuration guide

AccessLog
Syntax
AccessLog filename

Description 8f a filename is gi&en9 a logentr for each re/uest is :ritten to the file. The format of the file is the same as in other common :e# ser&ers. Example
AccessLog /var/log/tntnet/access.log

BufferSize
Syntax
BufferSize bytes

Description Specifies the num#er of # tes sent in a single s stem;call. This does not limit an thing in application;le&el. 8t does not affect e.g. sa&epoints or e)ception;handling. Component;output is collected completel and then passed in chun,s of BufferSize # tes to the operating s stem. The default &alue for this is 1'3.4. Example
BufferSize 32768

CompLifetime
Syntax
CompLifetime seconds

Description Components are instatiated :hen needed and reused. After the time specified here the instances are deleted. This defaults to '11 seconds. Example
CompLifetime 12

CompPath
Syntax
Comp!at" directory

Description CompPath specifies9 :here tntnet should search for :e#applications. Tntnet Tntnet configuration guide 3

searches first in the current director and then in each director 9 ou specif here9 until a li#rar is found. <ou can repeat the directi&e as man times as desired to add more entries. 8f it is not found9 the ne)t MapUrl; entr is tried. Example
Comp!at" /usr/local/li#/tntnet Comp!at" /usr/local/s"are/tntnet

Chroot
Syntax
C"root directory

Description Does a c"root$2%;s stem call on startup9 :hich loc,s the process into the director at s stem;le&el. Example
C"root /var/tntnet

Daemon
Syntax
&aemon '1

Description 8f this flag is set to 19 Tntnet for,s at startup and terminates the parent; process on successful initialization. Example
&aemon 1

DefaultContentType
Syntax
&efaultContent()pe contenttype

Description Sets the default content t pe. This content t pe is set in the http header9 if the component does not set it. The default is =te)t>html? charset@-T3;.A Example
&efaultContent()pe *te+t/"tml, c"arset-.S/880121*

Tntnet configuration guide

Dir
Syntax
&ir directory

Description Changes the current :or,ing director of the process on startup. Example
&ir /var/tntnet

EnableCompression
Syntax
3na#leCompression yes|no

Description Specifies9 if Tntnet should use gzip;compression at http;le&el. B default Tntnet use compression. A http;client li,e a :e# #ro:ser can send a header =Accept;"ncodingA9 to tell Tntnet9 that it :ould accept compressed data. Tntnet then can decide9 if it use compression. 6hen the #od is complete9 Tntnet tries to compress the #od . 8f the data can #e compressed # more than 11B9 Tntnet sends this compressed data. 6ith this flag9 this feature can #e turned off. Compression slo:s do:n processing #ut reduces the net:or,;load. 2ormall the size of html;pages can #e compressed # a#out +1B9 :hile Tntnet slo:s do:n # up to 31B. Example
3na#leCompression no

Group
Syntax
4roup unix-group

Description Changes the group under :hich tntnet ans:ers re/uests. Example
4roup tntnet2group

inclu e
Syntax
inclu5e filemask

Tntnet configuration guide

Description *eads additional settings from the specified files. filemask might contain glo#;characters9 so that multiple files might #e read. The order is not specified. Example
inclu5e /etc/tntnet.5/6.conf

!eepAli"eTimeout
Syntax
7eepAlive(imeout milliseconds

Description Sets the timeout for ,eep;ali&e re/uests. Tntnet tries to do ,eep;ali&e; re/uests :here&er possi#le. This has the effect9 that tntnet can recei&e multiple re/uests :ithin a single tcp;connection. The connection times out after KeepAliveTimeout milliseconds. The timeout defaults to 1!111ms. Example
7eepAlive(imeout 3

sets the ,eep;ali&e;timeout to ! minutes.

!eepAli"e#a$
Syntax
7eepAlive8a+ number

Description Sets the ma)imum num#er of re/uest per tcp;connection. This defaults to 111. Example
7eepAlive8a+ 1

Listen
Syntax
Listen ip [port]

Description Specifies9 on :hich address tntnet :aits for connections. There can #e more than one Listen;directi&es9 in :hich case tntnet :aits on e&er address. 8f there is no Listen;directi&e tntnet listens on 1.1.1.1 port .1. ip might also #e a hostname.

Tntnet configuration guide

'

Example
Listen 127. . .1 8

Listens on localhost on port .111.

Listen%etry
Syntax
Listen9etr) number

Description Cn startup Tntnet calls listen on the specified port. 6hen the s stemcall returns :ith an error9 Tntnet tries again and fails after the specified num#er of attempts. The default num#er is !. Example
Listen9etr) 1

*etries 11 times

ListenBac&log
Syntax
ListenBac:log number

Description The s stem;call listen needs a parameter #ac,log9 :hich specifies9 ho: man pending connections the operating;s stem should /ueue #efore it starts to ignore ne: re/uest. The &alue is configura#le here. The default &alue is 1'. Example
ListenBac:log 6;

Changes the #ac,log;/ueue to '4.

Loa
Syntax
Loa5 webapplication

Description Load specifies9 :hich :e#applications are preloaded on startup. 2ormall :e#applications are loaded as needed. The disad&antage is9 that there is no :a to chec, on startup9 if a application is loada#le at all. 6ith this directi&e startup fails9 if the application is not loada#le. Example
Loa5 m)app

Tntnet configuration guide

#ap'rl
Syntax
8ap<rl url component-identifier = path-info > additional-arguments ? @

Description Tells tntnet9 :hich component should #e called9 :hen it recei&es a http; re/uest. url is a regular e)pression9 :hich is tried against the re/uest;url. 8f it matches9 the component-identifier is e&aluated. component-idetifier ma contain #ac,references to the url. B default the url is passed as path;info to the component9 #ut this can #e changed :ith a third parameter. Additional parameters can #e passed to the component and accessed through tntDDhttp*e/uestDDgetArgsEF. 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
A maps 8ap<rl A maps 8ap<rl A maps 8ap<rl "tml2pages to components in m)app.so, e.g. /foo."tml calls fooBm)app /$=C/.@D%E."tml F1Bm)app Gpeg2urls to m)app, e.g. /foo.Gpeg calls fooHGpgBm)app /$=C/.@D%E.Gpeg F1HGpgBm)app /foo/#ar."tml to #arBfoo /$=C/.@D%/$=C/.@E."tml F2BF1

#a$'rl#apCache
Syntax
8a+<rl8apCac"e size

Description As descri#ed in (ap-rl urls are mapped to components :ith regular e)pressions. This is a /uite e)pensi&e operation9 :hile the num#er of different urls used in a t pical :e# application is small. Therefore Tntnet has a simple cache9 :hich stores mappings to pre&ent the need to process the same regular e)pression multiple times. The size of this cache is limited. After the size is e)ceeded the cache is simpl cleared. This clearing is logged :ith the message =clear url;map;cacheA. 8f ou ha&e a application :hit man different urls and ou often see this :arning;message9 ou might :ant to increase the cache. The default &alue is .105. Example
8a+<rl8apCac"e 32768

Tntnet configuration guide

#a$%e(uestSize
Syntax
8a+9eIuestSize number

Description This directi&e limits the size of the re/uest. After number B tes the connection is Gust closed. This pre&ents deniel;of;ser&ice;attac,s through long re/uests. "&er re/uest is read into memor 9 so it must fit into it. Bear in mind9 that if ou use file;upload;fields a re/uest might #e larger than Gust a fe: # tes. The &alue defaults to 19 :hich means9 that there is no limit at all. Example
8a+9eIuestSize 60036

#a$'rl#apCache
Syntax
8a+<rl8apCac"e number

Description Tntnet has a cache9 :hich stores results from the (ap-rl setting. Since processing regular e)pressions as used in (ap-rl does ta,e time and often onl a fe: distinct urls are processed9 the result is cached9 so that the regular e)pression is e)ecuted onl once. The cache is &er simple. 6hen the cache is full9 is it Gust discarded and the caching starts from the #eginning. Setting the cache size ma affect the performance of tntnet a little. 8t is setta#le here. The default size is .105 entries. Example
8a+<rl8apCac"e 206

#imeDb
Syntax
8ime&# file

Description The staticHtntnet component9 :hich sends files from the file s stem9 uses the specified file to loo, up the content t pe depending on the file e)tension. This is # default etc mime!t"pes.

Tntnet configuration guide

Example
8ime&# /usr/local/etc/mime.t)pes

#inCompressSize
Syntax
8inCompressSize number

Description Ittp;compression for replies smaller than this are not compressed at all. The default &alue for this is 1154. Example
8inCompressSize 1 2;

#inThrea s
Syntax
8in("rea5s number

Description Tntnet uses a d namic pool of :or,er;threads9 :hich :ait for incoming re/uests. MinThreads specifies9 ho: man :or,er threads there ha&e to #e. This defaults to !. Example
8in("rea5s 1

#a$Threa s
Syntax
8a+("rea5s number

Description Tntnet uses a d namic pool of :or,er;threads9 :hich :ait for incoming re/uests. Ma#Threads limits the num#er of threads. The default is 11. Example
8a+("rea5s 2

)oCloseSt out
Syntax
JoCloseSt5out '1

Tntnet configuration guide

11

Description 8f $aemon is set to 19 tntnet closes standard;in;9 standard;out; and standard; error;channels9 unless %oCloseStdout is set to 1. Example
JoCloseSt5out 1

)o#onitor
Syntax
Jo8onitor '1

Description Cn startup9 if $aemon is set to 19 tntnet does a second for,. The parent ,eeps :aiting for the child and the child does the :or,. 8f tntnet crashes9 :hat might happen9 :hen a :e#application is #ugg 9 the :or,er;process is restarted. This can #e s:itched off # setting %oMonitor to 1. Example
Jo8onitor

Pi *ile
Syntax
!i5Kile filename

Description 6hen run in daemon;mode9 tntnet :rites the process;id of the monitor; process to filename. 6hen the monitor;process is deacti&ated9 the pid of the :or,er;process is :ritten. This ensures9 that sending a sig,ill to the the stored process;id stops tntnet. Example
!i5Kile /var/run/tntnet.pi5

Property*ile
Syntax
!ropert)Kile filename

Description This directi&e specifies the propert ;file9 :here logging is configured. The content of the propert ;file is dependend of the underl ing logging;li#rar . Example
!ropert)Kile /etc/tntnet/tntnet.propert)

Tntnet configuration guide

11

+ueueSize
Syntax
LueueSize number

Description Tntnet has a re/uest;/ueue9 :here ne: re/uests :ait for ser&ice. This sets a ma)imum size of this /ueue9 after :ich ne: re/uests are not accepted. The default &alue is 111. Example
LueueSize 0

SessionTimeouot
Syntax
Session(imeout seconds

Description This sets the num#er of seconds :ithout re/uests after :hich a sesssion is erased. The default &alue is 311 seconds. Example
Session(imeout 6

Soc&et%ea Timeout
Syntax
Soc:et9ea5(imeout milliseconds

Description A :or,er;thread :aits for some milliseconds on incoming data. 8f there is no data9 the Go# is put into a /ueue and another thread :aits :ith pollE5F on incoming data on multiple soc,ets. The :or,erthreads are freed and the can respond to other re/uests /uic,l . The default &alue is 511 milliseconds9 :hich is good for normal operation. A &alue of 1 results in non;#loc,ing read. 8f timeout is reached9 this does not mean9 that the soc,et is closed. A small timeout reduces conte)ts:itches on slo: connections. Example
Soc:et9ea5(imeout

Tntnet configuration guide

15

Soc&et,riteTimeout
Syntax
Soc:etMrite(imeout milliseconds

Description This defines the time9 ho: long the :or,erthreads :ait on :rite. 8f the timeout is e)ceeded9 the soc,et is closed and the #ro:ser might not get all data. The default &alue is 11111 milliseconds. Example
Soc:etMrite(imeout 2

SslListen
Syntax
SslListen ip [port[ssl-certificate-file [ssl-key-file]]]

Description Specifies9 on :hich ip and port tntnet :aits for incoming ssl;connections. Cptionall a certificate; and ,e ;file can #e passed. Example
SslListen 112.168. .1 8;;3

6aits on the specified address and port on incoming ssl;connections. The ser&er is reacha#le :ith httpsD>>105.1'..1.1D.443>

Threa StartDelay
Syntax
("rea5Start&ela) ms

Description Example
("rea5Start&ela) 1

'ser
Syntax
<ser username

Description Example
<ser NNN25ata

Tntnet configuration guide

13

-#ap'rl
Syntax
O8ap<rl host url component-identifier = path-info > additional-arguments ? @

Description This is li,e (ap-rl9 #ut is specific for the &irtual host. This rule matches onl if the host and the url matches against the specified &alues. Both are regular;e)pressions9 so one rule can also match multiple hosts. Example
A maps reIuest for t"e "ost NNN1.tntnet.org to application1 O8ap<rl NNN1.tntnet.org /$=C/.@D% F1Bapplication1 A maps reIuest for t"e "ost NNN2.tntnet.org to application2 O8ap<rl NNN2.tntnet.org /$=C/.@D% F1Bapplication2 A maps all calls to port 8 to m)app O8ap<rl .6P8 /$=C/.@D% F1Bm)app

Tntnet configuration guide

14

Vous aimerez peut-être aussi