Home

Lesson 1: Server Setup

13:13 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.6 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.6 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
-virtualpaste.privyetmir.co.uk.tk /opt/tclhttpd/bin/rc-paste.privyetmir.co.uk {privyetmir.co.uk www.privyetmir.co.uk} /opt/tclhttpd/bin/rc-privyetmir.co.ukVirtual host config list
-config/opt/tclhttpd/bin/tclhttpd.rcConfiguration File
-main/opt/tclhttpd/bin/httpdthread.tclPer-Thread Tcl script
-docRoot/opt/tclhttpd/bin/../htdocsRoot directory for documents
-port8015Port number server is to listen on
-hostwww.patthoyts.tkServer name, should be fully qualified
-ipaddrInterface server should bind to
-ip6addrIPv6 Interface server should bind to
-https_port8016SSL Port number
-https_hostwww.patthoyts.tkSSL Server name, should be fully qualified
-https_ipaddrInterface SSL server should bind to
-webmasterpatthoyts@users.sourceforge.netE-mail address for errors
-uid33User Id that server runs under
-gid33Group Id for caching templates
-secs60Seconds per "minute" for time-based histograms
-threads4Number of worker threads (zero for non-threaded)
-library/opt/tclhttpd/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.patthoyts.tkMail Servers for sending email from tclhttpd
-daemon0Run in the background as a daemon process. Requires the 'Expect' package.

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