[::learn::header "Lesson 1: Server Setup"] [Doc_Dynamic]

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:
tclsh$tcl_version 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.
tclsh$tcl_version 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: [html::foreach {arginfo} $::CommandLineOptions { [html::foreach {arg default comment} $arginfo { [html::eval {regsub .arg $arg {} arg}] }] }]
optiondefaultdescription
-$arg$default$comment

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. [mypage::footer]