CGI Configuration

http://naviserver.sourceforge.net/ns_logobig.gif

MainSource Code Downloads API Documentation Mailing Lists Bugs Developers

NaviServer config for CGI

A simple NaviServer configuration file example to enable CGI.

set        package                        naviserver

# Absolute path to the installation directory
set         homedir                        /usr/lib/${package}

# Log directories (access log, error log, pidfile)
set        logdir                         /var/log/${package}
set        piddir                         /var/run/${package}

# Name/description of the virtual server
set        server_name                alpha

# The hostname, address and port for nssock should be set to actual values.
set        main_address                192.168.1.128
set        port                        80

################################################################
#
# Modules
#
################################################################
ns_section        "ns/server/${server_name}/modules"
   ns_param        nssock                        ${homedir}/bin/nssock.so
   ns_param        nscgi                   ${homedir}/bin/nscgi.so
   ns_param        nslog                         ${homedir}/bin/nslog.so


################################################################
#
# Global Parameters
#
################################################################
ns_section        "ns/parameters"
   # Home directory for the server, it will be resolved automaticlaly if not specified
   ns_param        home                        $homedir

   # Main server log file
   ns_param        serverlog               ${logdir}/cgi.log

   # Pid file of the server process
   ns_param        pidfile                 ${piddir}/cgi.pid


################################################################
#
# Servers
#
################################################################
ns_section        "ns/servers"
   ns_param        $server_name             "Naviserver $server_name"


################################################################
#
# nslog config
#
################################################################
ns_section         "ns/server/${server_name}/module/nslog"
   # Name to the log file
   ns_param           file                    ${logdir}/${server_name}-access.log


################################################################
#
# nssock config
#
################################################################
ns_section      "ns/module/nssock"
   ns_param     port                    $port
   ns_param     address                 $main_address
   ns_param     defaultserver           $server_name


ns_section         "ns/module/nssock/servers"
   ns_param           $server_name                 alpha.co.uk


################################################################
#
# Fastpath
#
################################################################
ns_section        "ns/server/${server_name}/fastpath"

   # Defines absolute or relative to serverdir directory where all
   # html/adp pages are located
ns_param            pagedir               /var/www/alpha.co.uk/

   # Directory index/default page to look for.
   ns_param        directoryfile         "index.adp index.html index.htm"



ns_section "ns/server/${server_name}/module/nscgi"
   ns_param           map                         "GET  /cgi-bin /usr/local/cgi-bin"
   # CGI script file dir (POST).
   ns_param           map                         "POST /cgi-bin /usr/local/cgi-bin"
# ns_param   map     "GET /xx"
# ns_param   interps CGIinterps


# ns_section "ns/interps/CGIinterps"
#  ns_param .tcl "/usr/bin/tclsh8.5"
#  ns_param .sh "/bin/sh"