1 # nsd.tcl -- The AOLserver Startup Script
3 # This is a Tcl script that is sourced when AOLserver starts up.
4 # A detailed reference is in "doc/config.txt".
7 ns_log notice "config.tcl: starting to read config file..."
11 # Set some Tcl variables that are commonly used throughout this file.
17 # The hostname and address should be set to actual values.
19 set hostname [ns_info hostname]
20 set address [ns_info address]
22 set servername "server1"
23 set serverdesc "Test Server"
25 set homedir [file dirname [ns_info nsd]]/..
26 set bindir ${homedir}/bin
28 set pageroot ${homedir}/share/nsd/servers/${servername}/pages
29 set directoryfile index.adp,index.html,index.htm
31 set ext [info sharedlibextension]
34 # Global server parameters
37 ns_section "ns/parameters"
38 ns_param home $homedir
45 ns_param dev true ;# Display logging with "Dev" severity
46 ns_param debug false ;# Display logging with "Debug" severity
47 ns_param logexpanded false ;# true = double-spaced server.log
48 ns_param logroll true ;# Roll server.log every 24 hours.
49 ns_param maxbackup 10 ;# Max number of old server.log files
50 ns_param pidfile "nspid" ;# PID of server (named "nspid.PORT")
51 ns_param serverlog "/var/log/nsd/${servername}.log" ;# Filename of server.log
55 # Thread library (nsthread) parameters
58 ns_section "ns/threads"
59 ns_param mutexmeter true ;# measure lock contention
60 ns_param stacksize [expr 128*1024] ;# Per-thread stack size.
65 # Note: AOLserver already has an exhaustive list of MIME types, but in
66 # case something is missing you can add it here.
69 ns_section "ns/mimetypes"
70 ns_param default "*/*" ;# MIME type for unknown extension.
71 ns_param noextension "*/*" ;# MIME type for missing extension.
72 #ns_param ".xls" "application/vnd.ms-excel"
74 ############################################################
76 # Server-level configuration
78 # There is only one server in AOLserver, but this is helpful when multiple
79 # servers share the same configuration file. This file assumes that only
80 # one server is in use so it is set at the top in the "server" Tcl variable.
81 # Other host-specific values are set up above as Tcl variables, too.
84 ns_section "ns/servers"
85 ns_param $servername $serverdesc
92 ns_section "ns/server/${servername}"
93 ns_param directoryfile $directoryfile
94 ns_param pageroot $pageroot
95 ns_param globalstats true ;# Enable built-in statistics.
96 ns_param urlstats true ;# Enable URL statistics.
97 ns_param maxurlstats 1000 ;# Max number of URL's to do stats on.
98 ns_param enabletclpages false ;# Parse *.tcl files in pageroot.
100 # Database Driver Configuration
102 # Sample config for postgres.
104 #ns_section "ns/db/drivers"
105 #ns_param postgres nspostgres.so
107 #ns_section "ns/db/pools"
108 #ns_param pgpool PGPool
110 #ns_section "ns/db/pool/pgpool"
111 #ns_param driver postgres
112 #ns_param connections 5
113 #ns_param datasource localhost:5432:webdatabase
114 #ns_param logsqlerrors on
116 #ns_param user "webuser"
118 #ns_section "ns/server/${servername}/db"
120 #ns_param DefaultPool pgpool
124 # Scaling and Tuning Options
126 # Note: These values aren't necessarily the defaults.
129 ns_param connsperthread 5 ;# Normally there's one conn per thread
131 #ns_param flushcontent false ;# Flush all data before returning
132 #ns_param maxconnections 100 ;# Max connections to put on queue
133 #ns_param maxdropped 0 ;# Shut down if dropping too many conns
134 #ns_param maxthreads 20 ;# Tune this to scale your server
135 #ns_param minthreads 0 ;# Tune this to scale your server
136 #ns_param threadtimeout 120 ;# Idle threads die at this rate
139 # Directory listings -- use an ADP or a Tcl proc to generate them.
140 #ns_param directoryadp $pageroot/dirlist.adp ;# Choose one or the other.
141 #ns_param directoryproc _ns_dirlist ;# ...but not both!
142 #ns_param directorylisting simple ;# Can be simple or fancy.
146 # ADP (AOLserver Dynamic Page) configuration
148 ns_section "ns/server/${servername}/adp"
149 ns_param map "/*.adp" ;# Extensions to parse as ADP's.
150 #ns_param map "/*.html" ;# Any extension can be mapped.
151 ns_param enableexpire false ;# Set "Expires: now" on all ADP's.
152 ns_param enabledebug false ;# Allow Tclpro debugging with "?debug".
155 ns_param errorpage ${pageroot}/test.adp ;# ADP error page.
159 # ADP custom parsers -- see adp.c
161 ns_section "ns/server/${servername}/adp/parsers"
162 ns_param adp ".adp" ;# adp is the default parser.
165 # TCL library location -- This is critical for NetBSD since we moved stuff
168 ns_section "ns/server/${servername}/tcl"
169 ns_param library ${homedir}/share/nsd/modules/tcl
173 # Socket driver module (HTTP) -- nssock
175 ns_section "ns/server/${servername}/module/nssock"
176 ns_param port $httpport
177 ns_param hostname $hostname
178 ns_param address $address
182 # Control port -- nscp
184 # nscp does not load unless nscp_user is a valid user.
186 #ns_section "ns/server/${servername}/module/nscp"
187 #ns_param port $nscp_port
188 #ns_param address $nscp_addr
190 #ns_section "ns/server/${servername}/module/nscp/users"
191 #ns_param user $nscp_user
195 # Access log -- nslog
197 ns_section "ns/server/${servername}/module/nslog"
198 ns_param rolllog false ;# Should we roll log?
199 ns_param rollonsignal true ;# Roll log on SIGHUP.
200 ns_param rollhour 0 ;# Time to roll log.
201 ns_param maxbackup 5 ;# Max number to keep around when rolling.
202 ns_param file "/var/log/nsd/${servername}access.log"
206 # CGI interface -- nscgi
208 # WARNING: These directories must not live under pageroot.
210 ns_section "ns/server/${servername}/module/nscgi"
211 #ns_param map "GET /cgi /usr/local/cgi" ;# CGI script file dir (GET).
212 #ns_param map "POST /cgi /usr/local/cgi" ;# CGI script file dir (POST).
218 ns_section "ns/server/${servername}/modules"
219 ns_param nssock ${bindir}/nssock${ext}
220 ns_param nslog ${bindir}/nslog${ext}
221 #ns_param nscgi ${bindir}/nscgi${ext} ;# Map the paths before using.
222 #ns_param nsperm ${bindir}/nsperm${ext} ;# Edit passwd before using.
225 # nscp: Only loads if nscp_user is set (see above).
227 #if { $nscp_user != "" } {
229 # if ![string match "127.0.0.1" $nscp_addr] {
230 # # Anything but 127.0.0.1 is not recommended.
231 # ns_log warning "config.tcl: nscp listening on ${nscp_addr}:${nscp_port}"
233 # ns_param nscp ${bindir}/nscp${ext}
236 # ns_log warning "config.tcl: nscp not loaded -- user/password is not set."
239 ns_log notice "config.tcl: finished reading config file."