BACK
Configuration

The server configuration is part of a config file that is meant to hold all of the services I am writing. So the server part has to start with a [server] entry. Below that follow the normal entries and after those a couple of sub-blocks. Between the single entries are no empty lines allowed, as the config processing routine interpretes an empty line as the end of the master block. The basic structure looks like this:

[server]
scheduler settings
global settings
default values
special settings
[-Logfile]
logfile options
[-Listen]
list of listen ports+addresses
[-Error-Redirect]
redirected errors (404/403/wrong referer/unknown mime)
[-Add-Header-Lines]
list of lines to add to the response headers
[-Referer]
list of allowed referer hosts
[-File-Types]
list of known file types
[-Directories]
list of allowed directories
[-Virtual-Servers]
list of virtual server names

The virtual servers have their own configuration, taking over the values from above and replacing them as needed. So most aspects of the virtual server can be changed. If something isn't there at all, the default values are used. Special settings are not copied! Mass Virtual Servers are a special case, so they have an own in depth page.

[server_name-Configuration]
(replacement of) default values
special settings
[-Logfile]
logfile options
[-Add-Header-Lines]
list of lines to add to the response headers
[-Error-Redirect]
redirected errors (404/403/wrong referer/unknown mime)
[-Referer]
list of allowed referer hosts
[-Directories]
list of allowed directories

Normal entries look like this:
entry_name=value; // comment

Depending on the type the value can either be a number or a string. A string should be placed in "" to avoid problems. It's also recommended to end the line with a ';'. Flag entries like "disable cache" don't take arguments and anything behind such an entry will be ignored

Those list type blocks are read line wise, so a comment is not possible. It's also no good idea to place comments behind subblock or block definitions. As long as you keep a line away from blocks however you can pretty much write anything you want within the file.


Example config file, comments would not be in the file:
Ouside of the main Blocks you can write just like this. But it would be a bad idea to use text
that might be mistaken as a block definition the config processing routine might actually seek.
Don't forget to use at least one empty line as seperation.

[Server]
sched=2; sets the scheduler to FIFO nice=1; with the lowest possible priority max_connections=1010; maximum number of 1000 workers worker_timeout=120; sets the timeout for stalling connections to 120 seconds keep_alive=1; keep alive only for 1 second keep_alive_num=20; limit it to 20 requests per connection max_cached_size=4096; files above 4096 Bytes will be sent using sendfile and won't be cached max_cache=100; max cache size set to 100 MByte just_stat_entry_max=2020; max number of just header cache entries cache_keep=180; time an idle cache entry survives, set to 3 minutes mainpage="index.html"; path to the main page of the default virtual server content_root="Seiten"; content root is "Seiten" folder in the current working directory default_mime=""; files with a not listed mime type will be blocked, unknown_mime_handler=404; resulting in a 404 not found error //disable cache; would disable cache use completely //disable mmap; would disable only the caching(mmapping) of files [-Logfile] enable logging; activate logging for the default vs and globally logfile="access%u.log"; logfile is in the work dir with the name access.log max_size=10000000; max size is set to 10 million byte max_entries=50000; max entries is set to 50000 lines intervall=86400; rotate every 24 hours (86400 seconds) keep in sync; data is written to disk in real time, bad for performance... [-Listen] n 192.168.0.1 80 1000 defer_accept listen on port 80, IP 192.168.0.1, listenlength of 1000 with tcp defer_accept s * 443 1000 listen on port 443, all interfaces, listenlength of 1000 (s/n not in use yet) [-File-Types] that's a list of the known mime types, is case insensitive .GIF image/gif .HTML text/html files that end (case insensitive) with ".html" are of content-type text/html .JPG image/jpeg .PNG image/png .TXT text/plain .CSS text/css .HTM text/html [-Directories] the list of directories the content might be in * allows only the root "Seiten" pics allows only the folder "pics" downloads allows only the folder "downloads" jokes* allows all paths starting with "jokes" stuff* allows all paths starting with "stuff" [-Error-Redirect] unknown_mime="/home/mine/error_pics/404notfound.gif"; 404="/home/mine/error_pics/404notfound.gif"; 403="/home/mine/error_pics/403denied.gif"; [-Virtual-Servers] the list of the virtual server names www.myserver.com - new.myserver.com - the '-' orders to use all the default values hsstvs.myserver.com * The '*' orders to look for a definition entry of the very same name myserver.com hsstvs.myserver.com private.myserver.com private use definition block with name "private" smilies.myserver.com smilies pic.myserver.com smilies redirect.myserver.com redir redir.myserver.com redir [redir-Configuration] redirect="http://www.minxam.com"; redirects all requests to "http://www.minxam.com" plus given path [smilies-Configuration] content_root="/home/mine/pictures"; mainpage=""; the empty entry will cause 404 if no path is given expires=86400; will add an expire date set to 86400 seconds after the request time [-Add-Header-Lines] Cache-Control: max-age=86400 [-Referer] *myserver.com requests with a referer host ending with "myserver.com" allowed forum.development.org requests with exactly that referer host are allowed [-Error-Redirect] unknown_mime="/home/mine/error_pics/404notfound.gif"; 404="/home/mine/error_pics/404notfound.gif"; 403="/home/mine/error_pics/403denied.gif"; referer="/home/mine/error_pics/403wrongreferer.gif"; [-Directories] * "*" allows the content root directory [private-Configuration] content_root="/home/mine/private"; mainpage="index.html"; mainpage would be "/home/mine/manual/index.html" [-Logfile] disable logging; disable the logging [-Directories] ** "**" allows the content root directory and its whole sub-tree [hsstvs.myserver.com-Configuration] content_root="manual"; mainpage="index.html"; mainpage would be working-directory+"manual/index.html" [-Logfile] enable logging; activate logging logfile="/var/logfiles/mass%u.log"; logfile is written into the dir /var/logfiles intervall=43200; rotate every 12 hours [-Directories] * "*" allows the content root directory, "**" would allow the whole sub-tree content allows the folder content ( wd+"manual/content") content/pics1 content/pics2

BACK