mongoose.1 5.9 KB

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