summaryrefslogtreecommitdiff
path: root/www/ap-aolserver/files/nsd.tcl.sample
blob: d7a7f9e62b52d55b0b29c6c4aaa96224436be262 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
#
# AOLserver/OpenNSD Sample Configuration File
#
# Improved with lots of comments and things you'll need for
# running OpenACS.
#
# by Roberto Mello (rmello@fslc.usu.edu)
# $Id: nsd.tcl.sample,v 1.1.1.1 2001/07/16 17:04:02 cjones Exp $
# $NetBSD: nsd.tcl.sample,v 1.1.1.1 2001/07/16 17:04:02 cjones Exp $

ns_log notice "nsd.tcl: starting to read config file..."

# 
# If httpport is set to 80, you'll have to start AOLserver as root and pass the user 
# AOLserver will run as in the command line. (e.g. ./nsd -u nsadmin -g nsadmin -t ../nsd.tcl)
# (assuming you're starting AOLserver from the {aolserverdir}/bin directory.

set httpport               80 
set httpsport             443 

#
# Make sure your /etc/hostname is setup right, with your full domain. If you want AOLserver 
# to listen to www.foobar.com instead of foobar.com then hard code the appropriate domain  
# in the line below (e.g. set hostname www.foobar.com).
#
set hostname              [ns_info hostname]  
set address               [ns_info address] 

# 
# You can name your server whatever you want, but you'll need a directory with that
# name under {aolserverdir}/servers/ writable by you AOLserver user.
#
# For example: if your AOLserver is in /usr/local/aolserver and your server is "server1"
# you will need a /usr/local/aolserver/servers/server1 directory.
#
set server		   "server1" 
set servername             "openacs" 

# 
# AOLserver's home and binary directories. Autoconfigurable. 
#
set homedir                 [file dirname [ns_info config]] 
set bindir                  [file dirname [ns_info nsd]] 

#
# Where are your pages going to live ?
#
set pageroot                /web/${server}/www 
set directoryfile           index.adp,index.tcl,index.html,index.htm

# 
# nsssl: Only loads if keyfile.pem and certfile.pem exist.
# If you are using SSL, make sure you have these dirs and files (refer
# to the AOLserver docs)

set sslkeyfile ${homedir}/servers/${server}/modules/nsssl/keyfile.pem

set sslcertfile ${homedir}/servers/${server}/modules/nsssl/certfile.pem 

# 
# Global server parameters 
#

ns_section "ns/parameters" 
        ns_param   home         $homedir 
        ns_param   debug        false 
        ns_param   MailHost     localhost 
        ns_param   ServerLog    ${homedir}/log/server.log 
        ns_param   LogRoll      on
	ns_param   AuxConfigDir ${homedir}/${server}/parameters

# 
# Thread library (nsthread) parameters 
# 
ns_section "ns/threads" 
        ns_param   mutexmeter      true      ;# measure lock contention 
        #ns_param   stacksize [expr 128*1024] ;# Per-thread stack size for hungry C modules

# 
# MIME types. 
# 
#  Note: AOLserver already has an exhaustive list of MIME types, but in
#  case something is missing you can add it here. 
#

ns_section "ns/mimetypes" 
        ns_param   default         "*/*"     ;# MIME type for unknown extension 
        ns_param   noextension     "*/*"     ;# MIME type for missing extension 
        #ns_param   ".xls"         "application/vnd.ms-excel''

# 
# Tcl Configuration 
# 
ns_section "ns/server/${server}/tcl" 
        ns_param autoclose 	"on" 
        ns_param debug 		"false" 
 

# This is where this server's private Tcl library is. All .tcl files in this directory 
# are parsed when AOLserver starts. The crucial procedures used in OpenACS are
# defined through this library
#
        ns_param library "/web/${server}/tcl" 

############################################################ 
# 
# Server-level configuration 
# 
#  There is only one server in AOLserver, but this is helpful when multiple
#  servers share the same configuration file.  This file assumes that only
#  one server is in use so it is set at the top in the "server" Tcl variable
#  Other host-specific values are set up above as Tcl variables, too.
# 
ns_section "ns/servers" 
        ns_param   $server     $servername 

# 
# Server parameters 
# 
ns_section "ns/server/${server}" 
        ns_param   directoryfile        $directoryfile 
        ns_param   pageroot             $pageroot 
        ns_param   globalstats          false     ;# Enable built-in statistics 
        ns_param   urlstats             false     ;# Enable URL statistics 
        ns_param   maxurlstats          1000      ;# Max number of URL's to do stats on
        ns_param   enabletclpages       true      ;# Parse tcl files in pageroot (dangerous)

#
# If you want to customize AOLserver's response to things like ``Internal Server Error''
# and other HTTP responses. OpenACS comes with some in the directory www/global.

        ns_param   NotFoundResponse   		"/global/file-not-found.html"
        ns_param   ServerBusyResponse	  	"/global/busy.html"
        ns_param   ServerInternalErrorResponse 	"/global/error.html"
        ns_param   ForbiddenResponse   		"/global/forbidden.html"
        ns_param   UnauthorizedResponse  	"/global/unauthorized.html"

# Directory listings -- use an ADP or a Tcl proc to generate them.
#
        #ns_param   directoryadp    $pageroot/dirlist.adp ;# Choose one or the other
        ns_param   directoryproc    _ns_dirlist           ;#  ...but not both! 
        ns_param   directorylisting  fancy                ;# Can be simple or fancy 
# 
# ADP (AOLserver Dynamic Page) configuration 
# 
ns_section "ns/server/${server}/adp" 
        ns_param   map           "/*.adp"  ;# Extensions to parse as ADP's 
        #ns_param   map          "/*.html" ;# Any extension can be mapped 
        ns_param   enableexpire  false     ;# Set "Expires: now" on all ADP's 
        ns_param   enabledebug   false     ;# Allow Tclpro debugging with "?debug"

 

# ADP special pages 
        #ns_param   errorpage      ${pageroot}/errorpage.adp ;# Pretty-print ADP scripting errors

# 
# ADP custom parsers -- see adp.c 
# 
ns_section "ns/server/${server}/adp/parsers" 
        ns_param   fancy            ".adp"

# 
# Socket driver module (HTTP)  -- nssock 
# 
ns_section "ns/server/${server}/module/nssock" 
        ns_param   port         $httpport 
        ns_param   hostname     $hostname 
        ns_param   address      $address

# 
# Socket driver module (HTTPS) -- nsssl 
# 
#  nsssl does not load unless sslkeyfile/sslcertfile exist (above).
# 
ns_section "ns/server/${server}/module/nsssl" 
        ns_param   port        $httpsport 
        ns_param   hostname    $hostname 
        ns_param   address     $address 
        ns_param   keyfile     $sslkeyfile 
        ns_param   certfile    $sslcertfile

# 
# Database drivers 
# The database driver is specified here. PostgreSQL driver being loaded.
# Make sure you have the driver compiled and put it in {aolserverdir}/bin
#
#ns_section "ns/db/drivers" 
#    ns_param   postgres     ${bindir}/postgres.so  ;# Load PostgreSQL driver

# 
# Database Pools: This is how AOLserver  ``talks'' to the RDBMS. You need three for
# OpenACS: main, log, subquery. Make sure to replace ``yourdb'' and ``yourpassword''
# with the actual values for your db name and the password for it.
# AOLserver can have different pools connecting to different databases and even different
# different database servers.
# 
ns_section "ns/db/pools" 
    ns_param   main       "OpenACS Main Pool" 
    ns_param   log        "OpenACS Log Pool" 
    ns_param   subquery   "OpenACS Subquery Pool"

ns_section "ns/db/pool/main" 
    ns_param Driver postgres 
    ns_param Connections 5                  ;# 5 is a good number. Increase according to your needs
    ns_param DataSource localhost::yourdb   ;# Replace 'yourdb' with the name of your database in PG
    ns_param User nsadmin                   ;# User and password AOLserver will use to connect
    ns_param Password "yourpassword" 
    ns_param Verbose Off                    ;# Set it to On to see all queries. Good for debugging SQL.
    ns_param LogSQLErrors On 
    ns_param ExtendedTableInfo On 
   # ns_param MaxOpen 1000000000            ;# Max time to keep idle db connection open
   # ns_param MaxIdle 1000000000            ;# Max time to keep active db connection open 

ns_section "ns/db/pool/log" 
    ns_param Driver postgres 
    ns_param Connections 5 
    ns_param DataSource localhost::yourdb 
    ns_param User nsadmin 
    ns_param Password "yourpassword" 
    ns_param Verbose Off
    ns_param LogSQLErrors On 
    ns_param ExtendedTableInfo On 
   # ns_param MaxOpen 1000000000 
   # ns_param MaxIdle 1000000000 

ns_section "ns/db/pool/subquery" 
    ns_param Driver postgres 
    ns_param Connections 2 
    ns_param DataSource localhost::yourdb 
    ns_param User nsadmin 
    ns_param Password "yourpassword" 
    ns_param Verbose Off
    ns_param LogSQLErrors On 
    ns_param ExtendedTableInfo On
   # ns_param MaxOpen 1000000000 
   # ns_param MaxIdle 1000000000 

ns_section "ns/server/${server}/db" 
        ns_param Pools          "main,subquery,log" 
        ns_param DefaultPool    "main"

#
# nscp: AOLserver Control Port - very useful for testing and evaluating.
# Uncomment the sample password below and do a "telnet localhost 9999"
# log in with "nsadmin", password "x", type "ns_crypt newpassword salt"
# and paste the new encrypted string below.
#
# Sample User="nsadmin", password="x" 
 set nscp_user              "nsadmin:t2GqvvaiIUbF2:"

# 
# Control port -- nscp 
#  nscp does not load unless nscp_user is a valid user. 
# 
ns_section "ns/server/${server}/module/nscp" 
        ns_param   port            9999 
        ns_param   address         "127.0.0.1" ;# LOCALHOST IS RECOMMENDED      

ns_section "ns/server/${server}/module/nscp/users" 
        ns_param   user            $nscp_user

# 
# Access log -- nslog 
# 
ns_section "ns/server/${server}/module/nslog" 
        ns_param   rolllog         true      ;# Should we roll log? 
        ns_param   rollonsignal    true      ;# Roll log on SIGHUP 
        ns_param   rollhour        0         ;# Time to roll log 
        ns_param   maxbackup       5         ;# Max number to keep around when rolling 

#
# nsjava - aolserver module that embeds a java virtual machine.  Needed to 
#          support webmail.  See http://nsjava.sourceforge.net for further 
#          details.
#

ns_section "ns/server/acs-pg/module/nsjava"
        ns_param   EnableJava          "off"  ;# Set to on to enable nsjava.
        ns_param   VerboseJvm          "off"  ;# Same as command line -debug.
        ns_param   LogLevel            "Notice"
        ns_param   DestroyJvm          "off"  ;# Destroy jvm on shutdown.
        ns_param   DisableJITCompiler  "off"  
        ns_param   ClassPath "/usr/local/jdk/jdk118_v1/lib/classes.zip:/usr/local/aolserver/bin/nsjava.jar:/home/nsadmin/mirror/acs3-pg/www/webmail/java/activation.jar:/home/nsadmin/mirror/acs3-pg/www/webmail/java/mail.jar:/home/nsadmin/mirror/acs3-pg/www/webmail/java" 

# 
# CGI interface -- nscgi, if you have legacy stuff. Tcl or ADP files inside 
# AOLserver are vastly superior to CGIs. You don't actually need the Interps 
# if your script calls the appropriate interpreter itself.
# 
#ns_section "ns/server/${server}/module/nscgi" 
#       ns_param   map "GET  /cgi-bin /web/$server/cgi-bin"
#       ns_param   map "POST /cgi-bin /web/$server/cgi-bin" 
#       ns_param   Interps CGIinterps

#ns_section "ns/interps/CGIinterps" 
#       ns_param .pl "/usr/bin/perl"

# 
# Modules to load 
# 
ns_section "ns/server/${server}/modules" 
        ns_param   nssock          ${bindir}/nssock.so 
        ns_param   nslog            ${bindir}/nslog.so 
#        ns_param   nsperm          ${bindir}/nsperm.so 
#        ns_param   nscgi           ${bindir}/nscgi.so 
        ns_param   nsjava          ${bindir}/libnsjava.so

#
## nsssl: loads only if requisite files already exist (see top of this
# file). 
#
if { [file exists $sslcertfile] && [file exists $sslkeyfile] } { 
    ns_param nsssl ${bindir}/nsssle.so 
} else { 
    ns_log warning "nsd.tcl: nsssl not loaded because key/cert files do not exist."
}

# nscp: loads only if nscp_user is set (see top of this file).
if { $nscp_user != "" } {
    ns_param nscp ${bindir}/nscp.so
} else {
    ns_log warning "nsd.tcl: nscp not loaded because user/password is not set."
}

# 
# To Source OpenACS Config File. You need a "yourservername.tcl" file in the
# OpenACS parameters dir. e.g.: say your server is "server1" then you'd need a
# file named /web/server1/parameters/server1.tcl
# (Hint: Rename ad.tcl to yourservername.tcl and edit it.)
#

source /web/${server}/parameters/${server}.tcl

ns_log notice "nsd.tcl: finished reading config file."