Cherokee Web Server: Server configuration

Server configuration

This section describes the Cherokee configuration files format. It shows the key entries and the expected behavior of all of them.

Table of contents

Binding

When the server starts it opens a port for start listening the incoming requests. By default this is the port 80. By default it will use all the network interfaces of the machine, which is usually the desired behavior. Anyway, it is possible to customize this using the Port and Listen configuration entries.

To attend port 81 instead of the port 80, just use:
Port 81
It is also possible to set a listening interface. To make the server accept connections only with one of the interface, for example, 193.127.101.100 just use:
Listen 193.127.101.100


IPv6 support

The IPv6 configuration key brings the possibility of activate or desactivate the IPv6 support at the server. If Cherokee has been compiled with IPv6 support, this configuration entry will be fully functional, otherwhise it will be ignored. It accepts two values: "On" and "Off". In order to desactivate IPv6 you should use:
IPv6 off


Execution User and Group

The User directive configures which user the Cherokee daemon will normally run as. By default, Cherokee runs as root which is considered undesirable in all but the most trustful network configurations. The User directive used in conjunction with the Group directive instructs the daemon to switch to the specified user and group as quickly as possible after startup. It is only possible to change the user and/or group if the server runs initially as root, otherwhise it will change it. There are two possible formats: using the user or group name, or using the system ID.

For example, to set the User and Group to "www-data":
User www-data
Group www-data
It is also possible to use a system user and/or group ID, for example:
User 65534
Group 65534


Document Root

This directive sets the directory from which Cherokee will serve files. Unless matched other posterior rule, the server appends the path from the requested URL to the document root to make the path to the document. Example:
DocumentRoot /var/www/

then an access to http://www.example.com/index.html refers to /var/www/index.html. There are methods to change this default behavior, take a look at the Directory keyword for more information.


Directory index files

The DirectoryIndex directive sets the list of resources to look for, when the client requests an index of the directory by specifying a / at the end of the directory name. Several URLs may be given, in which case the server will return the first one that it finds. If none of the resources exist, the server will reply according to the handler behavior.

DirectoryIndex index.html

then a request for http://www.example.com/docs/ would return http://www.example.com/docs/index.html if it exists, or would list the directory if it did not.

Note that the documents do not need to be relative to the directory:
DirectoryIndex index.html index.txt /cgi-bin/index.pl
would cause the CGI script /cgi-bin/index.pl to be executed if neither index.html or index.txt existed in a directory.


Server PID file

On startup, Cherokee saves the process id of the parent server process to the file cherokee.pid. Both, the feature and the filename can be changed with the PidFile directive. The process-id is for use by the administrator in restarting and terminating the daemon by sending signals to the parent process; For more information see the Stopping and Restarting page.
PidFile /var/run/cherokee.pid
If this configuration entry is not used, Cherokee won't write the file down.