Home

Lesson 1: Server Setup

22:29 PM Learn | Basic Setup | Templates | Server Security | Direct URLs | URL Domains

Out of Box Startup

This page describes how to set up the server for a standard "web page server" and as a platform for web applications. You have probably started the server using this simple command:
tclsh8.4 bin/httpd.tcl -debug 1
This runs the server using a standard selection of features and displaying the documents stored under htdocs in the distribution. If you want an alternate document root, use the -docRoot directory command line option.
tclsh8.4 bin/httpd.tcl -docRoot directory

When you specify the -debug flag, you get additional information printed as different modules are loaded. You also get a Tcl command prompt that lets you poke around in the main Tcl interpreter used by TclHttpd.

Here are the command line options understood by this server:
optiondefaultdescription
-virtualVirtual host config list
-configSTANDARD.rcConfiguration File
-main/opt/htbase/KITBASE/SERVER/STANDARD.kit/bin/httpdthread.tclPer-Thread Tcl script
-docRoot/opt/htbase/KITBASE/SERVER/STANDARD.kit/bin/../htdocsRoot directory for documents
-port80Port number server is to listen on
-hoststandard.prd.co.ukServer name, should be fully qualified
-ipaddrstandard.prd.co.ukInterface server should bind to
-https_port443SSL Port number
-https_hosttrafalgar.prd.co.ukSSL Server name, should be fully qualified
-https_ipaddrInterface SSL server should bind to
-webmasterwebmaster@prd.co.ukE-mail address for errors
-uid50User Id that server runs under
-gid50Group Id for caching templates
-secs60Seconds per "minute" for time-based histograms
-threads0Number of worker threads (zero for non-threaded)
-library/opt/htbase/KITBASE/SERVER/STANDARD.kit/bin/../customDirectory list where custom packages and auto loads are
-debug0If true, start interactive command loop
-compat3.3version compatibility to maintain
-gui1flag for launching the user interface
-mailMail Servers for sending email from tclhttpd

Adding Code

The server automatically sources the code in its custom code directory, which is specified by the -library command line argument. This feature allows you to "drop in" additional Tcl code without modifying the server. Your code can turn the basic server into a complete application.

The sampleapp directory of the distribution contains several examples contributed by TclHttpd users.
HomeStatusLearnCGI TestsTemplatesAccess ControlReference Manual