1mongoose(1) BSD General Commands Manual mongoose(1)
2
4 mongoose — lightweight web server
5
7 mongoose [config_file]
8 mongoose [OPTIONS]
9 mongoose -A htpasswd_file domain_name user_name password
10
12 mongoose is small, fast and easy to use web server with CGI, SSL, MD5
13 authorization, and basic SSI support.
14
15 mongoose does not detach from terminal, and uses current working direc‐
16 tory as the web root, unless -r option is specified. It is possible to
17 specify multiple ports to listen on. For example, to make mongoose listen
18 on HTTP port 80 and HTTPS port 443, one should start it as: mongoose -s
19 cert.pem -p 80,443s
20
21 Unlike other web servers, mongoose does not expect CGI scripts to be put
22 in a special directory. CGI scripts can be anywhere. CGI (and SSI) files
23 are recognized by the file extension.
24
25 If no arguments are given, mongoose searches for a configuration file
26 called "mongoose.conf" in the same directory where mongoose binary is
27 located. Alternatively, a file name could be specified in the command
28 line. Format of the configuration file is the same as for the command
29 line options except that each option must be specified on a separate
30 line, leading dashes for option names must be omitted. Lines beginning
31 with '#' and empty lines are ignored.
32
34 -A htpasswd_file domain_name user_name password
35 Add/edit user's password in the passwords file. Deleting users
36 can be done with any text editor. Functionality is similar to
37 Apache's htdigest utility.
38
39 -C cgi_extensions
40 Comma-separated list of CGI extensions. All files having these
41 extensions are treated as CGI scripts. Default: ".cgi,.pl,.php"
42
43 -E cgi_environment
44 Extra environment variables to be passed to the CGI script in
45 addition to standard ones. The list must be comma-separated list
46 of X=Y pairs, like this: "VARIABLE1=VALUE1,VARIABLE2=VALUE2".
47 Default: ""
48
49 -G put_delete_passwords_file
50 PUT and DELETE passwords file. This must be specified if PUT or
51 DELETE methods are used. Default: ""
52
53 -I cgi_interpreter
54 Use cgi_interpreter as a CGI interpreter for all CGI scripts
55 regardless script extension. Default: "". Mongoose decides which
56 interpreter to use by looking at the first line of a CGI script.
57
58 -M max_request_size
59 Maximum HTTP request size in bytes. Default: "16384"
60
61 -P protect_uri
62 Comma separated list of URI=PATH pairs, specifying that given
63 URIs must be protected with respected password files. Default: ""
64
65 -R authentication_domain
66 Authorization realm. Default: "mydomain.com"
67
68 -S ssi_extensions
69 Comma separated list of SSI extensions. Unknown SSI directives
70 are silently ignored. Currently, two SSI directives supported,
71 "include" and "exec". Default: "shtml,shtm"
72
73 -a access_log_file
74 Access log file. Default: "", no logging is done.
75
76 -d enable_directory_listing
77 Enable/disable directory listing. Default: "yes"
78
79 -e error_log_file
80 Error log file. Default: "", no errors are logged.
81
82 -g global_passwords_file
83 Location of a global passwords file. If set, per-directory
84 .htpasswd files are ignored, and all requests must be authorised
85 against that file. Default: ""
86
87 -i index_files
88 Comma-separated list of files to be treated as directory index
89 files. Default: "index.html,index.htm,index.cgi"
90
91 -l access_control_list
92 Specify access control list (ACL). ACL is a comma separated list
93 of IP subnets, each subnet is prepended by '-' or '+' sign. Plus
94 means allow, minus means deny. If subnet mask is omitted, like
95 "-1.2.3.4", then it means single IP address. Mask may vary from 0
96 to 32 inclusive. On each request, full list is traversed, and
97 last match wins. Default setting is to allow all. For example, to
98 allow only 192.168/16 subnet to connect, run "mongoose
99 -0.0.0.0/0,+192.168/16". Default: ""
100
101 -m extra_mime_types
102 Extra mime types to recognize, in form "extension1=type1,exten‐
103 sion2=type2,...". Extension must include dot. Example: "mongoose
104 -m .cpp=plain/text,.java=plain/text". Default: ""
105
106 -p listening_ports
107 Comma-separated list of ports to listen on. If the port is SSL, a
108 letter 's' must be appeneded, for example, "-p 80,443s" will open
109 port 80 and port 443, and connections on port 443 will be SSL-ed.
110 It is possible to specify an IP address to bind to. In this case,
111 an IP address and a colon must be prepended to the port number.
112 For example, to bind to a loopback interface on port 80 and to
113 all interfaces on HTTPS port 443, use "mongoose -p
114 127.0.0.1:80,443s". Default: "8080"
115
116 -r document_root
117 Location of the WWW root directory. A comma separated list of
118 URI_PREFIX=DIRECTORY pairs could be appended to it, allowing Mon‐
119 goose to serve from multiple directories. For example, "mongoose
120 -p /var/www,/config=/etc,/garbage=/tmp". Default: "."
121
122 -s ssl_certificate
123 Location of SSL certificate file. Default: ""
124
125 -t num_threads
126 Number of worker threads to start. Default: "10"
127
128 -u run_as_user
129 Switch to given user's credentials after startup. Default: ""
130
132 mongoose was designed to be embeddable into C/C++ applications. Since the
133 source code is contained in single C file, it is fairly easy to embed it
134 and follow the updates. Please refer to http://code.google.com/p/mongoose
135 for details.
136
138 mongoose -r /var/www,/aa=/tmp,/bb=/etc -s /etc/cert.pem -p 8080,8043s
139 Start listening on port 8080 for HTTP, and 8043 for HTTPS connec‐
140 tions. Use /etc/cert.pem as SSL certificate file. Web root is
141 /var/www. In addition, map directory /tmp to URI /aa, directory
142 /etc to URI /bb.
143
144 mongoose -l -0.0.0.0/0,+10.0.0.0/8,+1.2.3.4
145 Deny connections from everywhere, allow only IP address 1.2.3.4
146 and all IP addresses from 10.0.0.0/8 subnet to connect.
147
149 mongoose is licensed under the terms of the MIT license.
150
152 Sergey Lyubka <valenok@gmail.com>.
153
154 Aug 31, 2010