|MAN.CGI(8)||System Manager's Manual||MAN.CGI(8)|
man.cgi — CGI
program to search and display manual pages
man.cgi CGI program searches for
manual pages on a WWW server and displays them to HTTP clients, providing
functionality equivalent to the man(1) and
apropos(1) utilities. It can use
multiple manual trees in parallel.
At the top of each generated HTML page,
man.cgi displays a search form containing these
The expression is broken into words at whitespace. Whitespace characters and backslashes can be escaped by prepending a backslash. The effect of prepending a backslash to another character is undefined; in the current implementation, it has no effect.
-soption. Otherwise, pages from all sections are shown.
-Soption. By default, pages for all architectures are shown.
man.cgi program generates five kinds
of output pages:
PATH_INFOand without a
QUERY_STRING. It serves as a starting point for using the program and shows the search form only.
Xrlink on another manual page is followed.
For each manual tree, create one first-level subdirectory below
/var/www/man. The name of one of these directories
is called a “manpath” in the context of
man.cgi. Create a single ASCII text file
/var/www/man/manpath.conf containing the names of
these directories, one per line. The directory given first is used as the
Inside each of these directories, use the same directory and file structure as found below /usr/share/man, that is, second-level subdirectories /var/www/man/*/man1, /var/www/man/*/man2 etc. containing source mdoc(7) and man(7) manuals with file name extensions matching the section numbers, second-level subdirectories /var/www/man/*/cat1, /var/www/man/*/cat2 etc. containing preformatted manuals with the file name extension ‘0’, and optional third-level subdirectories for architectures. Use makewhatis(8) to create a mandoc.db(5) database inside each manpath.
man.cgi, first copy
cgi.h.example to cgi.h and
edit it according to your needs. It contains the following compile-time
man.cgidata directory relative to the web server chroot(2) directory, to be specified with a leading slash and without a trailing slash. It needs to have at least one component; the root directory cannot be used for this purpose. The files manpath.conf, header.html, and footer.html are looked up in this directory. It is also prepended to the manpath when opening mandoc.db(5) and manual page files.
After editing cgi.h, run
and copy the resulting binary to the proper location, for example using the command:
In addition to that, make sure the default manpath contains the files man1/apropos.1 and man8/man.cgi.8, or the documentation links at the bottom of the index page will not work.
man.cgi uniform resource identifiers are
not needed for interactive use, but can be useful for deep linking. They
SCRIPT_NAME, preceded by a slash unless empty.
arch, corresponding to apropos(1)
-S, respectively, and
apropos, which is a boolean parameter to select or deselect the apropos(1) query mode. For backward compatibility with the traditional
sektionis supported as an alias for
For security reasons, in particular to prevent cross site
scripting attacks, some strings used by
only contain the following characters:
In particular, this applies to all manpaths and architecture names.
The web server may pass the following CGI variables to
PATH_INFO. This is ignored by
man.cgi. When constructing URIs for links and redirections, the
SCRIPT_NAMEpreprocessor constant is used instead.
SCRIPT_NAMEand ending before the
QUERY_STRING. It is used by the
showpage to acquire the manpath and filename it needs.
searchpage to acquire the named parameters it needs.
man.cgiprogram inside the web server chroot(2) directory. A different name can be chosen, but in any case, it needs to be configured in httpd.conf(5).
man.cgidata directory containing all the manual trees. Can be overridden by
man.cgireports an internal server error and exits without doing anything.
man.cgi CGI program is call-compatible
with queries from the traditional man.cgi script by
Wolfram Schneider. However, the output looks quite different.
|May 20, 2018||OpenBSD-current|