This chapter describes how to configure TUX with the provided scripts.


Most parameters can only be set when TUX is not active.

List of Parameters

The following parameters are set through /proc/sys/net/tux. Note this has changed from the original location of /proc/sys/net/http and /proc/net/http.

Table 3-1. TUX Configuration Parameters

serverport80The port listened to by the main web server
clientport8080The port listened to by the userspace http-daemon
documentroot/var/www/htmlThe directory where the web pages are stored. If using the init script /etc/rc.d/init.d/tux, documentroot should be set in /etc/sysconfig/tux as DOCROOT.
404_page404.html If TUX does not manage to look up a requested page then it first tries to look up the document specified in 404_page. If the 404 page can not be found, the canned 404 message is sent. The file is relative to the document root.
threadsThe number or server-threads, set at most to 1 per CPUThe number of kernel threads (and associated daemon threads) to be used. Can not be greater than the number of CPUs on the system. If using the init script /etc/rc.d/init.d/tux, threads should be set in /etc/sysconfig/tux as TUXTHREADS.
mode_allowedS_IROTHRequired permissions for files TUX will process. See "man 2 stat" for all values.
mode_forbiddendir+sticky+executeFiles with this permission-mask are "forbidden" and will not be processed by TUX. See "man 2 stat" for all values.
nonagle2If set to 0, standard Nagle output packet merging. If set to 1, no Nagle merging of output packets. If set to 2, TCP_CORK-style output packet merging.
push_all0If set to 0, may merge subsequent packets. If set to 1, force a packet boundary right after the end of the TUX request.
compression0If set to 0, it is disabled. If set to 1, sending gzip compressed data is turned on. See the section called Compressed Gzip Data Stream for details.
cgi_uid-1UID as which to run CGI programs. Set by default to the ID for "nobody" in the tux init script.
cgi_gid-1GID as which to run CGI programs. Set by default to the ID for "nobody" in the tux init script.
cgiroot/var/www/tux/cgiroot/The directory in which TUX runs CGI programs. Set by default to $DOCROOT in the tux init script.
cgi_cpu_mask0xffffffffThe default value allows CGI scripts to execute on all CPUs. This value can be set to bind newly started CGI scripts to a single CPU or a set of CPUs. The CPUs are represented in a 32-bit bitmask, where bit 1 is CPU#0, bit 2 is CPU#1, etc. This value has not effect on single-processor systems.
cgi_inherit_cpu0If set to 1, all newly started CGI scripts inherit the CPU-binding of the CGI-starting TUX thread — all processes started by the CGI script will be bound to the same CPU as the parent CGI.
max_connect1000Maximum number of concurrent connections.
max_header_len3000Maximum header size in bytes.
max_output_bandwidth0Maximum output bandwidth used up by keepalive requests in bytes/sec. The default value of 0 means off or unlimited bandwidth. Can be as low as 1 byte/sec. This parameter replaces max_keepalive_bw.
max_keepalive1000Maximum number of open keepalive connections. After having reached max_keepalives connections, TUX zaps old connections based on LRU.
keepalive_timeout0Unfinished and should not be used. A per-client-connection timer that will time out if a request does not arrive within a pre-specified time. Timeout value is set in seconds.
max_object_size100MBMaximum file size TUX is willing to serve.
Dprintk0If TUX_DEBUG is turned on, then print out very verbose messages to syslog. Should only be used for debugging purposes.
ack_pingpong1Delay TCP ACK for incoming frames in the hopes of a subsequent output frame. Separate ACK will happen nevertheless, if no output frame is generated within a timeout.
all_userspace0If set to 1, every complete and valid HTTP request will be bounced to the first user-space module. The user-space module "takes control" over the entire URL space. Then, the user-space module can make a decision to 1) serve a static reply, 2) serve a cached dynamic reply, or 3) create a dynamic reply. If set to 0, all_userspace is disabled.
application_protocol0If set to 1, it enables the TUX FTP server. If set to 0, this feature is disabled. Refer to the section called TUX as an FTP Server for details.
logentry_align_orderN/ACurrently unused.
logfile/var/log/tuxThe filename of the TUX binary logfile. Refer to the section called Log Files in Chapter 2 for more information.
logging1If set to 1, logging is enabled. If set to 0, logging is disabled.
redirect_logging1Set to 0 to suppress redirected connections. Can be changed at runtime and takes effect immediately.
referer_logging0If set to 1, referer logging is enabled and will be automatically printed by tux2w3c if the referer entry is present. If set to 0, referer logging is disabled.
max_backlog2048Maximum size of SYN backlog of the TUX listening socket.
virtual_server0 (off)Turns on mass virtual hosting. Hosts are headers from the browser that are directly turned into $DOCROOT/<Host> 'virtual docroots.' This way any number of hosts can be served by a single TUX server without any performance penalty at all.
zerocopy_parse1Use the input packet buffer as a temporary buffer and avoids copying input data.
defer_accept0 (disabled if keepalive_timeout or max_keepalives is set)If set to 1, then TUX processes will not be woken up on the initial SYN-ACK event of a new TCP connection, but only after the first real data packet has arrived. If set to 0, this feature is disabled.

If the TUX init script /etc/rc.d/init.d/tux is used, the following parameters can be set in the file /etc/sysconfig/tux (see Table 3-2). They should not be set in /etc/sysctl.conf because the init script will override parameters set in /etc/sysctl.conf. Using the init script is the preferre method for starting TUX.

Table 3-2. /etc/sysconfig/tux parameters

TUXTHREADSThe number of server-threads, set at most to 1 per CPUThe number of kernel threads (and associated daemon threads) to be used, cannot be greater than the number of CPUs on the system
DOCROOT/var/www/htmlThe document root, the directory where the web pages are stored.
CGI_UIDnobodyUID (user) as which to run CGI programs.
CGI_GIDnobodyGID (group) as which to run CGI programs.
DAEMON_UIDnobodyUID (user) as which the daemon runs.
DAEMON_GIDnobodyGID (group) as which the daemon runs.
CGIROOT/var/www/htmlThe directory where the CGI programs are stored. CGI programs can be started in the chroot environment by default. Set CGIROOT=/ if you want CGI programs to have access to the whole system.
TUXMODULESdemo.tux demo2.tux demo3.tux demo4.tuxlist of user-space loadable TUX modules, see man 2 tux for more information
MODULEPATH/Path to the user-space loadable TUX modules

Required Parameters

Before starting TUX, the following parameters must be set:


The DOCROOT for TUX must be the same document root directory as Apache or other user-space daemon running as the assistant web server for TUX to properly redirect requests.