Home

Lesson 1: Server Setup

05:58 AM 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.5 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.5 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
-virtual mijuarez.juarez.gob.mx /etc/tclhttpd/virtuals/mijuarez.rc dnsbl.juarez.gob.mx /etc/tclhttpd/virtuals/dnsbl.rc www.juarez.gob.mx /etc/tclhttpd/virtuals/www.rc api.juarez.gob.mx /etc/tclhttpd/virtuals/api.rc css.juarez.gob.mx /etc/tclhttpd/virtuals/css.rc img.juarez.gob.mx /etc/tclhttpd/virtuals/img.rc js.juarez.gob.mx /etc/tclhttpd/virtuals/js.rc wstransito.juarez.gob.mx /etc/tclhttpd/virtuals/wstransito.rc Virtual host config list
-config/etc/tclhttpd/tclhttpd.rcConfiguration File
-main/usr/lib/tclhttpd3.5.1/httpdthread.tclPer-Thread Tcl script
-docRoot/usr/htdocsRoot directory for documents
-port80Port number server is to listen on
-hostserver4.mpioServer name, should be fully qualified
-ipaddr10.236.0.149Interface server should bind to
-https_port443SSL Port number
-https_hostserver4.mpioSSL Server name, should be fully qualified
-https_ipaddr10.236.0.149Interface SSL server should bind to
-webmasterwebmaster@juarez.gob.mxE-mail address for errors
-uidtclhttpdUser Id that server runs under
-gidtclhttpdGroup Id for caching templates
-secs60Seconds per "minute" for time-based histograms
-threads0Number of worker threads (zero for non-threaded)
-library/usr/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
-maillocalhostMail Servers for sending email from tclhttpd
-daemon0Run in the background as a daemon process. Requires either the 'Tclx' or '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