Karrigell Documentation

Version 2.3.3 15 01 07

Français

4. Configuration options

Configuration options are set in a configuration file. By default it is the Karrigell.ini file in the server directory. You can set it to a different file in the command line

A variable base is set by Karrigell before loading the configuration file, its value is the server directory. See example of use with %(base)s/ in the default Karrigell.ini file

The configuration file is split into several sections :

[Directories]

root
Set the root option to the full name of the Root Directory, the one from which you'll want to serve files. On installation it is not set, the default is the folder webapps in the Server Directory
cgi
The list of directories for cgi scripts
Defaults to webapps/cgi-bin in the Server Directory
protected
a list of protected directories ; for each script in these directories a script called AuthentScript.py will be automatically executed first. This script AuthentScript.py must be written by the administrator and put in the directory
By default, only the directory admin is protected. Use ";" to add other ones
allow_directory_listing
If a url matches a directory with no index file in it, determine who can read the directory content :
  • all = all users
  • none = no user

Defaults to "none"
hide_extensions
A list of file extensions that will be hidden (return error 403)
hide_paths
A list of regular expression patterns that will be matched to url paths ; if a match succeeds then the server will return error 403
This can be used to forbid access to a set of directories. For instance if you have a version control that creates directories named cvs you can forbid access to them with this line :
hide_paths = .*/cvs/.*
loggingFile
The name for a logging file. If not set, no logging is performed
loggingParameters
Parameters for logging handlers, refer to Python documentation, module logging
The following are for RotatingFileHandler: mode="a", maxBytes=1000000, backupCount=10
[Applications]
Maps file extensions to MIME types ; as far as I know this works with Netscape, but Internet Explorer overrides these settings
[Alias]
You can associate an alias to a path on the file system. For instance, if you create this alias :
scripts=
then the url htpp://localhost/scripts/index.htm will serve the file

[Server]

port
Set the port option to change the HTTP port (default 80)
reload_modules
If set to 1, all imported modules are reset at every import, so you don't have to restart the server when you change something in an imported script. Defaults to 1
debug
debug indicates if you want the "Debug" button to appear on the error pages. You might want to set it to 0 for security reasons. Default is 1 (the button is shown)
silent
If the silent option is set to 1, nothing is printed on the console window
gzip
If the gzip option is set to 1, and the user agent supports gzip encoding (most browsers do), the server compresses the data sent to the user agent. This reduces the use of the network, but slows down the server a little
global
In the global option, specify the path to the modules which must be imported in every script run by Karrigell. If you have a line like
global=%(base)s/myScript.py;%(base)s/myScript1.py
both modules myScript and myScript1 will be available in the namespace of all scripts
ignore
A list of urls to ignore if not found (return the HTTP code 204 instead of 404). Used by default to ignore the url /favicon.ico, searched by many browsers
[Translation]
Specifies the language used in the application, regardless of the options defined in the web browser. Set lang=default if you don't want any translation, lang=en if you want to use translations in English, etc

[VirtualHost name]

Karrigell supports the notion of virtual hosts, allowing to serve different hosts with different names on the same server

To specify a virtual host you add a line like this in the configuration file :

[VirtualHost name]
where name is the host name (like www.test.org)

In this section, you have to specify a directory from which the serve will serve the requests to this specific host :

root = /web/mydir

(1) you can also use an alternative built-in web server based on the modules SocketServer, BaseHTTPServer and SimpleHTTPServer module in the standard Python distribution : run python Karrigell_SocketServer.py

If you prefer a threaded server use python Karrigell_ThreadedSocketServer.py