# Overview Mongoose is small and easy to use web server. It is self-contained, and does not require any external software to run. On Windows, mongoose iconifies itself to the system tray icon when started. Right-click on the icon pops up a menu, where it is possible to stop mongoose, or configure it, or install it as Windows service. The easiest way to share a folder on Windows is to copy `mongoose.exe` to a folder, double-click the exe, and launch a browser at [http://localhost:8080](http://localhost:8080). Note that 'localhost' should be changed to a machine's name if a folder is accessed from other computer. On UNIX and Mac, mongoose is a command line utility. Running `mongoose` in terminal, optionally followed by configuration parameters (`mongoose [OPTIONS]`) or configuration file name (`mongoose [config_file_name]`) starts the web server. Mongoose does not detach from terminal. Pressing `Ctrl-C` keys would stop the server. When started, mongoose first searches for the configuration file. If configuration file is specified explicitly in the command line, i.e. `mongoose path_to_config_file`, then specified configuration file is used. Otherwise, mongoose would search for file `mongoose.conf` in the same directory where binary is located, and use it. Configuration file can be absent. Configuration file is a sequence of lines, each line containing command line argument name and it's value. Empty lines, and lines beginning with `#`, are ignored. Here is the example of `mongoose.conf` file: document_root c:\www listening_ports 8080,8043s ssl_certificate c:\mongoose\ssl_cert.pem When configuration file is processed, mongoose process command line arguments, if they are specified. Command line arguments therefore can override configuration file settings. Command line arguments must start with `-`. For example, if `mongoose.conf` has line `document_root /var/www`, and mongoose has been started as `mongoose -document_root /etc`, then `/etc` directory will be served as document root, because command line options take priority over configuration file. Configuration options section below provide a good overview of Mongoose features. Mongoose can also be used to modify `.htpasswd` passwords file: mongoose -A Unlike other web servers, mongoose does not require CGI scripts be located in a special directory. CGI scripts can be anywhere. CGI (and SSI) files are recognized by the file name pattern. Mongoose uses shell-like glob patterns. Pattern match starts at the beginning of the string, so essentially patterns are prefix patterns. Syntax is as follows: ** Matches everything * Matches everything but slash character, '/' ? Matches any character $ Matches the end of the string | Matches if pattern on the left side or the right side matches. All other characters in the pattern match themselves. Examples: **.cgi$ Any string that ends with .cgi /foo Any string that begins with /foo **a$|**b$ Any string that ends with a or b # Configuration Options Below is a list of configuration options Mongoose understands. Every option is followed by it's default value. If default value is not present, then it is empty. ### cgi_pattern `**.cgi$|**.pl$|**.php$` All files that match `cgi_pattern` are treated as CGI files. Default pattern allows CGI files be anywhere. To restrict CGIs to a certain directory, use `/path/to/cgi-bin/**.cgi` as pattern. Note that full file path is matched against the pattern, not the URI. ### cgi_environment Extra environment variables to be passed to the CGI script in addition to standard ones. The list must be comma-separated list of name=value pairs, like this: `VARIABLE1=VALUE1,VARIABLE2=VALUE2`. ### put\_delete\_passwords_file Passwords file for PUT and DELETE requests. Without it, PUT and DELETE requests will fail. ### cgi_interpreter Path to an executable to use as CGI interpreter for __all__ CGI scripts regardless script extension. If this option is not set (which is a default), Mongoose looks at first line of a CGI script, [shebang line](http://en.wikipedia.org/wiki/Shebang_(Unix)), for an interpreter. For example, if both PHP and perl CGIs are used, then `#!/path/to/php-cgi.exe` and `#!/path/to/perl.exe` must be first lines of the respective CGI scripts. Note that paths should be either full file paths, or file paths relative to the current working directory of mongoose server. If mongoose is started by mouse double-click on Windows, current working directory is a directory where mongoose executable is located. If all CGIs use the same interpreter, for example they are all PHP, then `cgi_interpreter` can be set to the path to `php-cgi.exe` executable and shebang line in the CGI scripts can be omitted. Note that PHP scripts must use `php-cgi.exe` executable, not `php.exe`. ### protect_uri Comma separated list of URI=PATH pairs, specifying that given URIs must be protected with respected password files. Paths must be full file paths. ### authentication_domain `mydomain.com` Authorization realm used in `.htpasswd` authorization. ### ssi_pattern `**.shtml$|**.shtm$` All files that match `ssi_pattern` are treated as SSI. Unknown SSI directives are silently ignored. Currently, two SSI directives are supported, `