[NANOWEB DOCUMENTATION]

NANOWEB, the aEGiS PHP web server

nanoweb Server Core

The nanoweb configuration files reside in /etc/nanoweb/ and following configuration directive can currently be used in the main server configuration file nanoweb.conf or in the .nwaccess files:
Starting from nanoweb 1.8.1 you may write all directives in apache style without the equal sign in between a directives` name and its value.


AccessFile directive

Syntax: AccessFile = .nwaccess
Context: Server Config, Virtual Hosts
Status: Core

Specifies the filename of the per-directory config files to be read. This is .nwaccess per default, but you may want to set it to .htaccess so nanoweb uses the files you previously used with apache.



Access_RBL directive

Syntax: Access_RBL = dns | web
Context: Server Config
Status: mod_access_rbl

Gives the prefered RBL query method. The default "dns" is much faster than the http access method "web".
See also mail-abuse.org/rbl for further informations on the RBL system.
Note: The maps service is free for personal usage only; but you can easily edit this nanoweb modules` code to use another one if desired.



AddHeader directive

Syntax: AddHeader = X-HTTP-Header: value
Context: Server Config, Virtual Hosts
Status: Core

You can append additional headers to the HTTP responses nanoweb sends back to the client (browser).
This directive can of course be used in [vhosts] configurations too.



Alias directive

Syntax: Alias = /virtual/ /real/path/
Context: Server Config, Virtual Hosts
Status: Core

Declares an alias directory name to an existing path of the real filesystem. This directive can be used to get access to a directory from within any virtual host, as in the rewriting process the docroot gets changed.
This directive is used by mod_fb for example, to always keep the /icons/ directory reachable.

In apache used to be a »ScriptAlias« directive which does exactly the same, so please forget about that and just use »Alias« in nanoweb.



AllowExtSymlinks directive

Syntax: AllowExtSymlinks = 1
Context: Server Config, Virtual Hosts
Status: Core

nanoweb cannot be utilized to access other files than these located above any docroot (main server and virtual host ones). This directive set to 1 allows to access files pointed to via symlinks regardless of their location in the filesystem.



AllowPathInfo directive

Syntax: AllowPathInfo = 1
Context: Server Config, Virtual Hosts, .nwaccess
Status: Core

Any CGI may be called with a »pathinfo« appended to its filename (think of http://www.example.com/cgi-bin/program.php/arg1/arg2), which is treaten by many CGI interpreters as additional data input beside the »query string«.



AuthFile directive

Syntax: AuthFile = .nwauth
Context: Server Config, Virtual Hosts
Status: Core

Sets the filename of the HTTP authentication data file. If a file with this name is present in the requested page's directory, the browser will be asked for authentication. Authentication file format is almost the same as apache .htpasswd:

realm name
login:des_encrypted_password
2nd_login:des_pw ...



BSPAllowSource directive

Syntax: BSPAllowSource = 1
Context: Server Config
Status: mod_bsp

Allows to view the source of .bsp scripts when ?source is appended to the requested url.



CGIFilterPathInfo directive

Syntax: CGIFilterPathInfo = 1
Context: Server Config
Status: Core

If you plan to use the CGI version of PHP you should leave this enabled, as there still is a unfixed bug in PHP-CGI that forbids passing the PATH_INFO server var to the scripts.



ChildLifeTime directive

Syntax: ChildLifeTime = 21600
Context: Server Config
Status: Core

The absolute maximum time (in seconds) a child process is allowed to live.



DefaultContentType directive

Syntax: DefaultContentType = text/plain
Context: Server Config
Status: Core

When the server cannot determine a MIME-type by examining the extensions of the requested file, it will tell the client the file is of the type set with this directive. The default of text/plain may not always match your requirements, so setting this value to text/html can do a better job in some cases.



DirectoryIndex directive

Syntax: DirectoryIndex = index.html index.php
Context: Server Config, Virtual Hosts
Status: Core

With this directive you may specify one or more files, which get sent in favour of a directory listing when found. This directive may also be used in the per-directory configuration files (.nwaccess)
You may want to set it to just "index" if you activated mod_multiviews, as this is more flexible.



DocumentRoot directive

Syntax: DocumentRoot = /var/www
Context: Server Config, Virtual Hosts
Status: Core

Base directory path nanoweb will serve files from.
This directive needs to be present in each virtual host configuration part.



ErrorDocument directive

Syntax: ErrorDocument = CODE errorNNN.html
Context: Server Config, Virtual Hosts
Status: Core

Files to send on errors instead of the default (built-in) messages of nanoweb. These documents have to reside in the docroot.



FallBackPriority directive

Syntax: FallBackPriority = smallest | largest | newest | oldest
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_multiviews

If the mime qualities of all available file variants are equal, then mod_multiviews can at least select the smallest, largest, newest or the oldest file out of them.



FastCGIFilterPathInfo directive

Syntax: FastCGIFilterPathInfo = 1
Context: Server Config
Status: Core, mod_fcgi

see CGIFilterPathInfo



FBDescFile directive

Syntax: FBDescFile = .desc
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_fb

Descriptions of each file out of a directory may be given in the file specified here. Such a description file should look like:

filename.ext   desc of this file
index.html  main/homepage...



FBIconByType directive

Syntax: FBIconByType = /icons/image.gif mime/type
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_fb

Associates icons pictures to mime types for output in directory listings produced by mod_fb.
You may specify partial mime-types only; so you can associtate fall-back icons for general mime types like »application«, »text« or »image«.
The default configuration of nanoweb also utilizes the Alias directive to keep all icons in a single directory (/icons/ which is rewritten to absolute real path /var/www/icons/) accessible from all the virtual hosts.



FBIconDefault directive

Syntax: FBIconDefault = /icons/misc.gif
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_fb

If none of the FBIconByType directives defines an appropriate icon for a file (or if a files mime type is unknown) this directive gives the name of the image to be used.



FBIconDirectory directive

Syntax: FBIconDirectory = /icons/directory.gif
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_fb

Defines the icon to be printed for directories.



FBShowDotFiles directive

Syntax: FBShowDotFiles = 1
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_fb

This tells mod_fb to include files which names start with a dot to be included in directory listings. On UNIX machines these »dotfiles« should be treaten as invisible files by standard programs; and because nanoweb keeps some of its per-directory configurations in .nwaccess and .nwauth you probably want to set this directive to the default of 1.



FBSortOrder directive

Syntax: FBSortOrder = name | size | date [ desc ]
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_fb

Directory listings are sorted by mod_fb according to this setting (»name« is the default). The use of »desc« reverses the order.



FBTemplateFooter directive

Syntax: FBTemplateFooter = .fbfooter
Context: Server Config, Virtual Hosts
Status: mod_fb

Define a footer template filename (printed below directory listings).
The macro "@genpage_signature@" can be used in such a file to display the standard nanoweb server signature.



FBTemplateHeader directive

Syntax: FBTemplateHeader = .fbheader
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_fb

Define a header template for use with the file browser.
Available macros for use in the files specified with this directive are "@real_uri@" to display the requested directory, and "@welcome_formated@" for the formated welcome file (if any is present).



FBWelcomeFile directive

Syntax: FBWelcomeFile = .welcome
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_fb

Whenever a directory listing (»filebrowser«) is to be sent back to the client, the server searches for a file with the hereby given name to be included in the sent output.



FileBrowser directive

Syntax: FileBrowser = 1
Context: Server Config, Virtual Hosts
Status: mod_fb
Compatibility: separated out from the core server in 1.8-dev

Is to activate / disactivate the automatic generation of directory listings by the server.



Group directive

Syntax: Group = groupid
Context: Server Config
Status: Core

Default group nanoweb will run as (defaults ot »www-data«).



GzipEnable directive

Syntax: GzipEnable = 1
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_gzip

This directive allows you to enable/disable mod_gzip for each virtual host or different directories (in .nwaccass).



GzipMaxRatio directive

Syntax: GzipMaxRatio = 90
Context: Server Config
Status: mod_gzip

Max compression ratio (percentage of original size). If it is higher, the content is likely to be already compressed and does not need a recompression.



HostnameLookups directive

Syntax: HostnameLookups = 1
Context: Server Config
Status: Core

Use reverse-DNS to put hostnames instead of IP addresses into server log.
Note that using DNS slows down nanoweb a bit, so if you need some more speed you should think about disabling this feature, as you can get the names of the hosts which requested pages from your server later too by evaluating the server logs with appropriate software.



IgnoreDotFiles directive

Syntax: IgnoreDotFiles = 1
Context: Server Config, Virtual hosts, .nwaccess
Status: Core

Setting this directive to 1 will make nanoweb ignore .xxx files. This is for security reasons (not allowing clients to request .nwaccess or .nwauth files for example). You shouldn't change this unless you know exactly what you're doing.



Include directive

Syntax: Include = /path/to/file.conf
Context: Server Config
Status: Core

This directive reads another (swapped out) configuration file into the current one. In standard installations the main configuration file is /etc/nanoweb/nanoweb.conf which additionally loads modules.conf and vhosts.conf using this directive.



KeepAlive directive

Syntax: KeepAlive = 25
Context: Server Config
Status: Core

Maximum number of http requests per connection (A client may get more than one file after it opened a connection to nanoweb, to speed up downloading of multiple files). To disable the keep-alive feature of nanoweb just set this value to 0.


LanguagePriority directive

Syntax: LanguagePriority = en fr de
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_multiviews

Content-negotiation occurs if the requested file does not exist, but some variants can be found instead. If the client doesn't specifies a preferred language this setting will come into use.



ListenInterface directive

Syntax: ListenInterface = 127.0.0.1
Context: Server Config
Status: Core

Specify the IP address the server shall listen to for incoming connections.



ListenPort directive

Syntax: ListenPort = 80
Context: Server Config
Status: Core

Specify the TCP port number the server shall listen on for incoming connections. 80 is the default for web servers, but 8080 is also very common.



ListenQueue directive

Syntax: ListenQueue = 20
Context: Server Config
Status: Core

Maximum number of queued connections.



LoadLimit directive

Syntax: Loadlimit = 25.0
Context: Server Config
Status: mod_load_limit

Defines the maximum load average after which the server will return an error and won't serve documents until load goes down.



LoadModule directive

Syntax: LoadModule = /usr/lib/nanoweb/modules/mod_fb.php
Context: Server Config
Status: Core

This directive is usually found in /etc/nanoweb/modules.conf, which is included into the main server configuration file. It registers the specified module to the server core in the startup sequence of nanoweb.
You need to specify the full pathname of the PHP source file containing the module.



Log directive

Syntax: Log = /var/log/nanoweb/access.log
Context: Server Config
Status: Core

Specifies file where nanoweb notes all served requests.



LoggerProcess directive

Syntax: LoggerProcess = 2
Context: Server Config
Status: Core

Logger Process support. If enabled, nanoweb will spawn logger processes at launch and all logging will be done by them. This can help if you are using User or Group directives or simply want more performance from the server. Set to the number of loggers you want, or 0 to disable.



LoggerUser directive

Syntax: LoggerUser = userid
Context: Server Config
Status: Core

User the nanoweb loggers will run as.



LoggerGroup directive

Syntax: LoggerGroup = groupid
Context: Server Config
Status: Core

Group the nanoweb loggers will run as.



LogToConsole directive

Syntax: LogToConsole = 1
Context: Server Config
Status: mod_stdlog

Logs every hit to standard output. Of course this requires you not to run nanoweb in daemon mode via nanoctl start, you need to run nanoweb.php from shell.



MispellAction directive

Syntax: MispellAction = advice
Context: Server Config (modules.conf)
Status: mod_mispell

The mispell module handles incorrectly entered URLs. If a file with the given name cannot be found on the server it tries to figure out the correct name by checking the sounding of the filename against that of the files located on the server. This directives says what to do if it finds the correct name for the requested file. Default is »advice« which sends back an error page to the user, presenting him the corrected URL. You can also specify »redirect« which will send back a HTTP redirection response to the browser, so the users browser automagically re-requests with the corrected URL.



MimeTypes directive

Syntax: MimeTypes = /etc/mime.types
Context: Server Config
Status: Core

Reads in the system-wide available MIME-types database from given file, and thus makes nanoweb recognize hundreds of typical file extensions.



MultiViews directive

Syntax: MultiViews = 1
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_multiviews

This directive enables / disables mod_multiviews, so you can use the negotiation features only in directories you actually need them.



MySQLLogHost directive

Syntax: MySQLLogHost = localhost
Context: Server Config (modules.conf)
Status: mod_mysqllog

The mysqllog module saves request hits to a database instead of saving it to files as mod_stdlog does. So you need to give a hostname here, where a MySQL database server runs on.



MySQLLogDatabase directive

Syntax: MySQLLogDatabase = databasename
Context: Server Config (modules.conf)
Status: mod_mysqllog

Sets the name of the MySQL database for request logging.



MySQLLogUser directive

Syntax: MySQLLogUser = mysql_username
Context: Server Config (modules.conf)
Status: mod_mysqllog

You need an account for access to a MySQL database server.



MySQLLogPassword directive

Syntax: MySQLLogPassword = mysql_password
Context: Server Config (modules.conf)
Status: mod_mysqllog

You need an account for access to a MySQL database server.



Negotiation directive

Syntax: Negotiation = server | agent
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_multiviews

You should leave this set to "server", as most browsers don't support agent-driven content-negotiation and just will present the error page sent back to them for this case.



OtherPriority directive

Syntax: OtherPriority = php; qs=0.3, text/html; qs=0.2, image/*; qs=0.1
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_multiviews

These gives additional preferences that will help mod_multiviews in selecting the "best" variant when the browser didn't send an Accept: header. Note that you can mix file extensions (without dot!) and mime types; quality-values help a lot.



ParseExt

Syntax: ParseExt = extension TYPE [parameters]
Context: Server Config
Status: Core, mod_cgi, mod_fcgi

Defines which extensions will be parsed and how.
Valid types are defined by the modules you loaded. Parameters are type dependant (CGI takes path to CGI program, FCGI to FastCGI server socket, while SSI doesn't requires a parameter).



PathInfoTryExt directive

Syntax: PathInfoTryExt = php
Context: Server Config, Virtual Hosts, .nwaccess
Status: Core

This directive gives CGI extensions that should be checked for if a file with a pathinfo is requested but no file extension is there. You should use multiple PathInfoTryExt lines, one for each CGI extension you would like to leave out.
See also AllowPathInfo



PidFile directive

Syntax: PidFile = /var/run/nanoweb.pid
Context: Server Config
Status: Core

This directive gives a filename where nanoweb logs which pid (=process id, on Unix systems) it runs as.



ReflectRewriting directive

Syntax: ReflectRewriting = 1
Context: Server Config, Virtual Hosts, .nwaccess
Status: mod_rewrite, mod_multiviews

If a URL is rewritten via a RewriteRule or because of some content negotiation, this setting influences if the rewritten URL (or if unset the requested one) shall be presented in error messages that may occur.



RewriteRule directive

Syntax: RewriteRule REGEX REPLACEMENT [flags,...]
Context: .nwaccess
Status: mod_rewrite

Mappes the requested file name to real one by rewriting with usage of regular expressions pattern matching. Please refer to the modules` documentation for a short explanation.



RewriteCond directive

Syntax: RewriteCond TESTSTRING CONDPATTERN [flags,...]
Context: .nwaccess
Status: mod_rewrite

Does additional regex tests that trigger if the following RewriteRule gets executed (on success of this RewriteCond).



RequestTimeout directive

Syntax: RequestTimeout = 15
Context: Server Config
Status: Core

Nanoweb will wait specified amount of time for receival of the actual http request after a TCP/IP connection was established, before it closes this connection again to not prevent others from correctly connecting.



ServerAdmin directive

Syntax: ServerAdmin = webmaster@example.com
Context: Server Config, Virtual Hosts
Status: Core

Admin mail address present in most of the server generated pages (errors, status, directory listings).



ServerAlias directive

Syntax: ServerAlias = www.secondname.example.net
Context: Server Config, Virtual Hosts
Status: Core

This gives an additional DNS name the server shall listen to. There may be multiple of this but only one ServerName directive.



ServerMode directive

Syntax: ServerMode = standalone
Context: Server Config
Status: Core

You may wish to run nanoweb in standalone mode in most cases. This is, the nanoweb server is started to stay resident in memory and waiting for incoming connections.
Another variant of using the nanoweb server is by invoking it via inetd - the »internet superserver« used on many UNIX systems to startup internet services on oncoming requests, which leads to some overhead and is slower in general as one copy of nanoweb.php needs to be executed for each requested file.



ServerName directive

Syntax: ServerName = www.example.com
Context: Server Config, Virtual Hosts
Status: Core

Default DNS-name of this server. You may append a port number to the name.



SingleProcessMode directive

Syntax: SingleProcessMode = 1
Context: Server Config
Status: Core

This is used to force nanoweb in single process mode. You should uncomment it when running in win32 or if your php binary was not compiled with pcntl.



StatusAllowHost directive

Syntax: StatusAllowHost = 127.0.0.1
Context: Server Config
Status: mod_status

This gives an IP of a host allowed to consult the server status through /server-status. Multiple lines with this directive may be specified; an incomplete IP address can be used to allow a range of host addresses to be granted access.



TempDirectory directive

Syntax: TempDirectory = /tmp
Context: Server Config
Status: Core

This specifies where nanoweb shall put temporary files into, so this directory should be read/writeable by the user/group nanoweb will run as.



User directive

Syntax: User = userid
Context: Server Config
Status: Core

Default user nanoweb will run as (the user name is »www-data« per dafault).



UserDir directive

Syntax: UserDir = public_html
Context: Server Config, Virtual Hosts
Status: Core

This is the subpath which nanoweb will look for in users homedir when an URL like http://webserver/~user is requested.
This directive can be set in the global section or for each virtual host.



WormsRun directive

Syntax: WormsRun = /usr/bin/command [args...]
Context: Server Config
Status: mod_worms

Commands specified with such directives are executed, if a worm is detected.
Please refer to the file README.mod_worms (in the docs/ directory of the unpacked tarball) as mod_worms requires additional preparation to work.



WormsWpopText directive

Syntax: WormsWpopText = message text ...
Context: Server Config
Status: mod_worms

Text that is sent to the offending IIS server console.




NANOWEB, the aEGiS PHP web server

Index