# 
#  AOLserver startup settings
#

#
#  Global settings
#
set home                "/usr/lib/aolserver"
set host           [ns_info hostname]
set server              "nmd"
set servername          ""
set directoryfile  "index.html, index.htm"
set pageroot            "/var/www3/nmd/www"
set httpport            80

ns_section "ns/parameters"
ns_param ServerName   $servername
ns_param ServerLog    "/var/log/aolserver/aolserver.${server}.log"
ns_param PidFile      "/var/run/aolserver/aolserver.${server}.pid"
ns_param User         www-data
ns_param Home         "/usr/lib/aolserver"

#
#  Data structure settings
#
ns_param dstringcachemaxentries   10              ;# Max # of DStrings to put in cache
ns_param dstringcachemaxsize      [expr 3*1024]   ;# Max # of DStrings to put in cache
ns_param iobufsize         16000           ;# Buffer size for I/O

#
#  Limits (these are good areas to play with for optimizations)
#
ns_param keepalivetimeout    30      ;# Max time connection is kept alive
                                    ;# Set to 0 to disable
ns_param listenbacklog           32      ;# Max length of pending connection queue
ns_param maxkeepalive                100     ;# Max num of keep alive connections
ns_param schedmaxelapsed      2       ;# Warn when waiting on really long procs
ns_param shutdowntimeout    20       ;# Secs to wait on shutdown if open conns

#
#  Server logging
#
ns_param dev             true        ;# Display logging with "Dev" severity
ns_param debug           false             ;# Display logging with "Debug" severity
ns_param logexpanded     false         ;# true = double-spaced server.log
ns_param logroll         false         ;# Roll server.log every 24 hours.
ns_param maxbackup       10              ;# Max number of old server.log files

# DNS tuning
ns_param dnscache        true         ;# In-memory cache of DNS lookups
ns_param dnscachetimeout 60              ;# How long to keep hostnames in cache

# Miscellaneous
ns_param checkexitcode   false       ;# Check exit code on forked process
ns_param crashcmd        ns_crash     ;# A Tcl command that dumps core.
ns_param mailhost        smtp.yourcompany.com ;# SMTP host for ns_sendmail

#
# Thread library (nsthread) parameters
#
ns_section "ns/threads"
ns_param mutexmeter      true       ;# measure lock contention
ns_param stacksize       [expr 128*1024]  ;# stack size per thread (in bytes)

#
# 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


############################################################
#
# 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.
#

ns_section "ns/servers"
ns_param $server       $servername     ;# Name of virtual server.

#
# Server parameters
#
ns_section "ns/server/${server}"
ns_param directoryfile   $directoryfile        ;# List of files to use (index.html)
ns_param pageroot        $pageroot ;# Directory under which all pages live

# Tuning options
ns_param connsperthread  0                 ;# Normally there's one conn per thread
ns_param flushcontent    false        ;# Flush all data before returning
ns_param maxconnections  100       ;# Max connections to put on queue
ns_param maxdropped      0              ;# Shut down if dropping too many conns
ns_param maxthreads      20                  ;# Tune this to scale your server
ns_param minthreads      0         ;# Tune this to scale your server
ns_param threadtimeout   120          ;# Idle threads die at this rate

# Limits
ns_param maxheaders      16384            ;# Max no. of headers from client
ns_param maxline         8192            ;# Max line length from client
ns_param maxpost         65536              ;# Max bytes on a POST
ns_param sendfdthreshold 2048         ;# Min size of file descriptor to send

# Performance statistics gathering
ns_param globalstats     true            ;# Enable built-in statistics
ns_param urlstats        true                ;# Enable URL statistics
ns_param maxurlstats     1000         ;# Max number of URL's to do stats on

# Miscellaneous
ns_param checkmodifiedsince true     ;# Check url if no If-Modified-Since?
ns_param headercase      preserve      ;# tolower, toupper, preserve

#
# Internal redirects
#
#ns_section "ns/server/${server}/redirects"
#ns_param 404      "/notfound.html"        ;# Not Found error page
#ns_param 500       "/servererror.html"     ;# Server Error page

#
# Fastpath serves HTML
#
ns_section "ns/server/${server}/fastpath"
ns_param cache           true           ;# Enable cache for normal URLs
ns_param cachemaxentry   8192         ;# Largest file size allowable in cache
ns_param cachemaxsize    [expr 5000*1024] ;# Size of fastpath cache
ns_param mmap            false                ;# Use mmap() for cache

#
# Tcl interpreter
#
ns_section "ns/server/${server}/tcl"
ns_param autoclose       true               ;# Close files the Tcl interp opened
ns_param debug           false           ;# Names of files sourced is logged
ns_param nsvbuckets      8           ;# No. of buckets to hold nsv's
ns_param statlevel       0                ;# How many levels deep to run tclstats
ns_param statmaxbuf      100           ;# Maximum entries in tclstats table
ns_param library \
    "$home/servers/${server}/modules/tcl" ;# Private tcl library for the server

#
# ADP (AOLserver Dynamic Page) configuration
#
ns_section "ns/server/${server}/adp"

# ADP features
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           ;# Turn on Tclpro debugging with "?debug"
ns_param debuginit   "ns_adp_debuginit" ;# Debug procedure

# ADP tuning
ns_param   cache           true      ;# In-memory cache of ADP's
ns_param   cachesize       [expr 5000*1024]
ns_param   taglocks        false     ;# Enable post-ini creation of ADP tags
ns_param   threadcache     false     ;# default for Tcl 7.6 (nsd76)
ns_param   threadcache     true      ;# default for Tcl 8.2 (nsd82)

# ADP special pages
#ns_param   errorpage \
#    ${pageroot}/errorpage.adp        ;# Pretty-print ADP errors with an ADP
#ns_param   startpage \
#    ${pageroot}/startpage.inc        ;# Page to include for all ADP's


#
# ADP custom parsers -- see adp.c
#
ns_section "ns/server/${server}/adp/parsers"
ns_param   adp             ".adp"   ;# The simple parser looks for <% ... %>
ns_param   fancy           ".adp"   ;# The fancy parser does a lot more.


#
# Socket driver module (HTTP)  -- nssock
#
ns_section "ns/server/${server}/module/nssock"
ns_param Port         80
ns_param   hostname        $host     ;# This is not the same as your hostname
#ns_param   address         $address  ;# This is not the same as your host addr
#ns_param   location        "url"     ;# URL for auto-redirects (trailing slash)


#
# Control port -- nscp
#
ns_section "ns/server/${server}/module/nscp"
ns_param port            9999      ;# Control port listens on port 9999
ns_param address         "127.0.0.1" ;# For security, use 127.0.0.1 only
ns_param reconnection off
# Control port users
ns_section "ns/server/${server}/module/nscp/users"
ns_param user         "www-data::"


#
# Access log -- nslog
#
ns_section "ns/server/${server}/module/nslog"
ns_param   file            "/var/log/aolserver/access.${server}.log"
ns_param   formattedtime   true      ;# true=common log format
ns_param   logcombined     false     ;# true==NCSA combined format
ns_param   maxbackup       5         ;# Max number to keep around when rolling
ns_param   rollhour        0         ;# Time to roll log
ns_param   rolllog         true      ;# Should we roll log?
ns_param   rollonsignal    true      ;# Roll log on SIGHUP

#
# CGI interface -- nscgi
#
# Note: CGI is *vastly* inferior to ADP's or even built-in Tcl libraries.
#
ns_section "ns/server/${server}/module/nscgi"
ns_param debug           false          ;# Be chatty in log
ns_param gethostbyaddr   false            ;# Whether to do reverse DNS lookups
ns_param limit           0            ;# Max number of concurrent CGI processes
ns_param maxoutput       10240           ;# Max bytes allowed from external process
ns_param buffersize      8192          ;# Buffer output from external process
ns_param Map              "GET /*.cgi"
ns_param Map             "GET /*.py"
ns_param Map                "GET /cgi-bin /usr/lib/cgi-bin";# This should point to local CGI progs
ns_param Map            "GET /cgi-lib /usr/lib/cgi-bin"
ns_param Map               "GET /doc /usr/share/doc"
ns_param Map                "POST /*.pl"
ns_param Map             "POST /*.py"
ns_param Interps      CGIinterps

ns_section "ns/interps/CGIinterps"
ns_param .cgi          "/usr/bin/perl"
ns_param .sh          "/bin/sh"
ns_param .py          "/usr/bin/python"

# CGI environment variable handling -- See admin guide
ns_param   systemenvironment false   ;# Copies environment from nsd start shell


#
# Access control (permissions) -- nsperm
#
ns_section "ns/server/${server}/module/nsperm"

#
# Unix domain socket driver -- nsunix
#
ns_section "ns/server/${server}/module/nsunix"
ns_param   hostname        "host"    ;# Hostname used in response to client
ns_param   port            "port"    ;# Port to listen on
ns_param   socketfile      "path.name" ;# UNIX domain socket driver

#
# Virtual Hosting redirector -- nsvhr
#
ns_section "ns/server/${server}/module/nsvhr"
ns_param   busyurl         "url"     ;# Redirect here if back-end times out
ns_param   errorurl        "url"     ;# Redirect here on proxy errors
ns_param   method          "GET"     ;# Methods allowed to proxy
ns_param   method          "POST"    ;# Methods allowed to proxy (can have >1)
ns_param   timeout         30        ;# Timeout waiting for back-end

# Register hosts to proxy
#ns_section "ns/server/${servername}/module/nsvhr/maps"
#ns_param   "www.tcpsocket.com"    "http://127.0.0.0:2000" ;# HTTP proxy
#ns_param   "www.domainsocket.com" "unix://somehost"       ;# Domain socket

#
# Modules to load
#
# Note: Only load the modules you are actually going to use.
#
ns_section "ns/server/${server}/modules"
ns_param nssock             nssock.so
ns_param nscp               nscp.so
ns_param nslog              nslog.so
ns_param nscgi              nscgi.so
ns_param nsperm             nsperm.so
ns_param tclmodule          tcl


