|
fbc3b2f…
|
drh
|
1 |
<title>CGI Script Configuration Options</title> |
|
fbc3b2f…
|
drh
|
2 |
|
|
fbc3b2f…
|
drh
|
3 |
<h1>Summary</h1> |
|
fbc3b2f…
|
drh
|
4 |
|
|
fbc3b2f…
|
drh
|
5 |
It is not necessary to have a central server in order to use Fossil. |
|
fbc3b2f…
|
drh
|
6 |
But a central server can help a project run more smoothly by giving developers |
|
fbc3b2f…
|
drh
|
7 |
a common point of rendezvous for syncing, and by providing a web-based |
|
fbc3b2f…
|
drh
|
8 |
portal where developers and non-developers alike can learn about the |
|
fbc3b2f…
|
drh
|
9 |
project and its current state. |
|
fbc3b2f…
|
drh
|
10 |
|
|
fbc3b2f…
|
drh
|
11 |
Setting up a server using Fossil is easy. |
|
f146e21…
|
drh
|
12 |
A [./server/|separate document] talks about all of the many different methods for |
|
f146e21…
|
drh
|
13 |
setting up a Fossil server, one of which is [./server/any/cgi.md | as a CGI |
|
f146e21…
|
drh
|
14 |
script]. CGI is the technique that the three |
|
fbc3b2f…
|
drh
|
15 |
[./selfhost.wiki|self-hosting Fossil repositories] all use. |
|
fbc3b2f…
|
drh
|
16 |
|
|
fbc3b2f…
|
drh
|
17 |
Setting up a Fossil server using CGI is mostly about writing a short |
|
efd79f8…
|
drh
|
18 |
script (usually just 2 lines) in the cgi-bin folder of an ordinary |
|
7dd07b2…
|
drh
|
19 |
web-server. But there are a lot of extra options that can be added |
|
7dd07b2…
|
drh
|
20 |
to this script, to customize the configuration. This article describes |
|
fbc3b2f…
|
drh
|
21 |
those options. |
|
fbc3b2f…
|
drh
|
22 |
|
|
fbc3b2f…
|
drh
|
23 |
<h1>CGI Script Options</h1> |
|
fbc3b2f…
|
drh
|
24 |
|
|
fbc3b2f…
|
drh
|
25 |
The CGI script used to launch a Fossil server will usually look something |
|
fbc3b2f…
|
drh
|
26 |
like this: |
|
fbc3b2f…
|
drh
|
27 |
|
|
8a1ba49…
|
wyoung
|
28 |
<verbatim> |
|
fbc3b2f…
|
drh
|
29 |
#!/usr/bin/fossil |
|
fbc3b2f…
|
drh
|
30 |
repository: /home/www/fossils/myproject.fossil |
|
8a1ba49…
|
wyoung
|
31 |
</verbatim> |
|
fbc3b2f…
|
drh
|
32 |
|
|
a92365d…
|
drh
|
33 |
Of course, pathnames will likely be different. The first line |
|
a92365d…
|
drh
|
34 |
(the "[wikipedia:/wiki/Shebang_(Unix)|shebang]") |
|
fbc3b2f…
|
drh
|
35 |
always gives the name of the Fossil executable. Subsequent lines are of |
|
fbc3b2f…
|
drh
|
36 |
the form "<b>property: argument ...</b>". |
|
fbc3b2f…
|
drh
|
37 |
The remainder of this document describes the available properties and |
|
fbc3b2f…
|
drh
|
38 |
their arguments. |
|
fbc3b2f…
|
drh
|
39 |
|
|
fbc3b2f…
|
drh
|
40 |
<hr> |
|
282402d…
|
wyoung
|
41 |
|
|
fbc3b2f…
|
drh
|
42 |
<h2 id="repository">repository: <i>PATH</i></h2> |
|
fbc3b2f…
|
drh
|
43 |
|
|
fbc3b2f…
|
drh
|
44 |
This property defines the Fossil repository that the server will use. |
|
fbc3b2f…
|
drh
|
45 |
Every Fossil CGI requires either this property or the |
|
fbc3b2f…
|
drh
|
46 |
[#directory|<b>directory:</b>] property (but not both). |
|
a92365d…
|
drh
|
47 |
Many Fossil CGI scripts have this one property and no other. |
|
a92365d…
|
drh
|
48 |
|
|
282402d…
|
wyoung
|
49 |
|
|
fbc3b2f…
|
drh
|
50 |
<h2 id="directory">directory: <i>PATH</i></h2> |
|
fbc3b2f…
|
drh
|
51 |
|
|
fbc3b2f…
|
drh
|
52 |
The PATH is the name of a directory that contains one or more Fossil |
|
c7b9f05…
|
stephan
|
53 |
repository files having the suffix ".fossil". If this property is |
|
c7b9f05…
|
stephan
|
54 |
used instead of [#repository|<b>repository:</b>], then the Fossil |
|
c7b9f05…
|
stephan
|
55 |
server is able to serve all of the repositories in the directory. The |
|
c7b9f05…
|
stephan
|
56 |
specific repository used is selected by a prefix on the PATH_INFO. See |
|
c7b9f05…
|
stephan
|
57 |
the notes for the [#repolist|<b>repolist</b>] option regarding name |
|
c7b9f05…
|
stephan
|
58 |
collisions between subdirectories and repository files. |
|
282402d…
|
wyoung
|
59 |
|
|
779ddef…
|
wyoung
|
60 |
|
|
779ddef…
|
wyoung
|
61 |
<h2 id="notfound">notfound: <i>URL</i></h2> |
|
779ddef…
|
wyoung
|
62 |
|
|
779ddef…
|
wyoung
|
63 |
If the [#directory|<b>directory:</b>] option is used and if the PATH_INFO |
|
779ddef…
|
wyoung
|
64 |
of the HTTP request does not correspond to any Fossil repository, then |
|
779ddef…
|
wyoung
|
65 |
the request redirects to URL. |
|
282402d…
|
wyoung
|
66 |
|
|
779ddef…
|
wyoung
|
67 |
|
|
779ddef…
|
wyoung
|
68 |
<h2 id="repolist">repolist</h2> |
|
779ddef…
|
wyoung
|
69 |
|
|
779ddef…
|
wyoung
|
70 |
This is a Boolean property. |
|
779ddef…
|
wyoung
|
71 |
If it is present, and if the [#directory:|<b>directory:</b>] option is used, |
|
779ddef…
|
wyoung
|
72 |
and if the PATH_INFO string is empty, then Fossil will show a list |
|
779ddef…
|
wyoung
|
73 |
of available Fossil repositories. |
|
779ddef…
|
wyoung
|
74 |
|
|
779ddef…
|
wyoung
|
75 |
The "skin" of the reply is determined by the first |
|
779ddef…
|
wyoung
|
76 |
repository in the list that has a non-zero |
|
c64f28d…
|
drh
|
77 |
[/help/repolist-skin|repolist-skin] setting. |
|
c591bbe…
|
florian
|
78 |
|
|
779ddef…
|
wyoung
|
79 |
If no repository has such a non-zero repolist-skin setting, then |
|
c591bbe…
|
florian
|
80 |
the repository list is generic HTML without any decoration, with |
|
c591bbe…
|
florian
|
81 |
the page title taken from the <tt>FOSSIL_REPOLIST_TITLE</tt> |
|
c591bbe…
|
florian
|
82 |
environment variable. The variable can be defined in the CGI |
|
c591bbe…
|
florian
|
83 |
control file using the [#setenv|<tt>setenv:</tt>] statement. |
|
fbd7731…
|
drh
|
84 |
|
|
fbd7731…
|
drh
|
85 |
The "Project Description" and "Login-Group" columns on the repolist page |
|
d9bd156…
|
drh
|
86 |
are optional. They are hidden by default. Show them by |
|
d9bd156…
|
drh
|
87 |
etting the <tt>FOSSIL_REPOLIST_SHOW</tt> environment variable to |
|
fbd7731…
|
drh
|
88 |
a string that contains substrings "description" and/or "login-group". |
|
c7b9f05…
|
stephan
|
89 |
|
|
c7b9f05…
|
stephan
|
90 |
The repolist-generated page recurses into subdirectories and will list |
|
c7b9f05…
|
stephan
|
91 |
all <tt>*.fossil</tt> files found, with the following exceptions: |
|
c7b9f05…
|
stephan
|
92 |
|
|
c7b9f05…
|
stephan
|
93 |
* Filenames starting with a period are treated as "hidden" and skipped. |
|
c7b9f05…
|
stephan
|
94 |
|
|
c7b9f05…
|
stephan
|
95 |
* Subdirectory names which match the base name of a fossil file in |
|
c7b9f05…
|
stephan
|
96 |
the same directory are listed in the resulting page but are not |
|
c7b9f05…
|
stephan
|
97 |
hyperlinked because the links would be ambiguous and the |
|
c7b9f05…
|
stephan
|
98 |
repositories in the subdirectories would be unreachable to |
|
c7b9f05…
|
stephan
|
99 |
clients. For example, any repositories under subdirectory |
|
c7b9f05…
|
stephan
|
100 |
<tt>XYZ</tt> are unreachable if <tt>XYZ.fossil</tt> exists in |
|
c7b9f05…
|
stephan
|
101 |
the same directory as <tt>XYZ</tt>, noting that this particular |
|
c7b9f05…
|
stephan
|
102 |
name check is case-insensitive. The entries for such |
|
c7b9f05…
|
stephan
|
103 |
repositories are clearly marked in the repolist page's output to |
|
c7b9f05…
|
stephan
|
104 |
make the user aware of the problem. To make them accessible, |
|
c7b9f05…
|
stephan
|
105 |
move them into a directory which does not share a base name with |
|
c7b9f05…
|
stephan
|
106 |
a repository file. |
|
282402d…
|
wyoung
|
107 |
|
|
282402d…
|
wyoung
|
108 |
|
|
282402d…
|
wyoung
|
109 |
<h2 id="localauth">localauth</h2> |
|
282402d…
|
wyoung
|
110 |
|
|
282402d…
|
wyoung
|
111 |
This is a Boolean property. |
|
282402d…
|
wyoung
|
112 |
If it is present, [./caps/ref.html#s | setup capability] |
|
282402d…
|
wyoung
|
113 |
is granted to any HTTP request that |
|
282402d…
|
wyoung
|
114 |
comes in over a loopback interface, such as 127.0.0.1. |
|
282402d…
|
wyoung
|
115 |
|
|
282402d…
|
wyoung
|
116 |
|
|
282402d…
|
wyoung
|
117 |
<h2 id="skin">skin: <i>NAME</i></h2> |
|
282402d…
|
wyoung
|
118 |
|
|
282402d…
|
wyoung
|
119 |
If NAME is the name of one of the built-in skins supported by Fossil, |
|
282402d…
|
wyoung
|
120 |
then this option causes Fossil to display using that built-in skin, |
|
282402d…
|
wyoung
|
121 |
and to ignore any custom skin that might be configured in the repository |
|
282402d…
|
wyoung
|
122 |
itself. |
|
282402d…
|
wyoung
|
123 |
|
|
282402d…
|
wyoung
|
124 |
So, if you wanted to set up a server for a single Fossil project, but |
|
282402d…
|
wyoung
|
125 |
also give users the option to use several of the different built-in |
|
282402d…
|
wyoung
|
126 |
skins, you could create multiple CGI scripts, each with a different |
|
282402d…
|
wyoung
|
127 |
"<b>skin:</b>" property, but all pointing to the same <b>repository:</b>. |
|
282402d…
|
wyoung
|
128 |
Then users can select which skin to use by using the appropriate CGI. |
|
282402d…
|
wyoung
|
129 |
|
|
282402d…
|
wyoung
|
130 |
|
|
282402d…
|
wyoung
|
131 |
<h2 id="files">files: </i>GLOBLIST</i></h2> |
|
282402d…
|
wyoung
|
132 |
|
|
282402d…
|
wyoung
|
133 |
The GLOBLIST argument is a comma-separate list of "globs" that specify |
|
282402d…
|
wyoung
|
134 |
filenames. In [#directory|<b>directory:</b> mode], if the PATH_INFO |
|
282402d…
|
wyoung
|
135 |
does not identify any Fossil repository, but it does refer some other |
|
282402d…
|
wyoung
|
136 |
file in the directory, and that filename matches one of the glob patterns |
|
282402d…
|
wyoung
|
137 |
in the GLOBLIST, then the file is returned as static content. |
|
282402d…
|
wyoung
|
138 |
|
|
282402d…
|
wyoung
|
139 |
|
|
282402d…
|
wyoung
|
140 |
<h2 id="setenv">setenv: <i>NAME VALUE</i></h2> |
|
282402d…
|
wyoung
|
141 |
|
|
282402d…
|
wyoung
|
142 |
This parameter causes additional environment variable NAME to have VALUE. |
|
282402d…
|
wyoung
|
143 |
This parameter can be repeated as many times as necessary. |
|
282402d…
|
wyoung
|
144 |
|
|
282402d…
|
wyoung
|
145 |
|
|
282402d…
|
wyoung
|
146 |
<h2 id="HOME">HOME: <i>PATH</i></h2> |
|
282402d…
|
wyoung
|
147 |
|
|
282402d…
|
wyoung
|
148 |
This parameter is a short-hand for "<b>setenv HOME <i>PATH</i></b>". |
|
282402d…
|
wyoung
|
149 |
|
|
282402d…
|
wyoung
|
150 |
|
|
282402d…
|
wyoung
|
151 |
<h2 id="cgi-debug">cgi-debug: <i>FILE</i></h2> |
|
282402d…
|
wyoung
|
152 |
|
|
282402d…
|
wyoung
|
153 |
Cause CGI-related debugging information to be appended in <i>FILE</i>. Use |
|
282402d…
|
wyoung
|
154 |
this to help debug CGI problems. |
|
282402d…
|
wyoung
|
155 |
|
|
282402d…
|
wyoung
|
156 |
|
|
282402d…
|
wyoung
|
157 |
<h2 id="errorlog">errorlog: <i>FILENAME</i></h2> |
|
282402d…
|
wyoung
|
158 |
|
|
282402d…
|
wyoung
|
159 |
This setting causes the server to log any errors in FILENAME. |
|
282402d…
|
wyoung
|
160 |
It is ok for multiple Fossil CGIs to share the same error log. |
|
282402d…
|
wyoung
|
161 |
|
|
282402d…
|
wyoung
|
162 |
Setting up an error log for Fossil servers is not required, but it |
|
282402d…
|
wyoung
|
163 |
is recommended. |
|
282402d…
|
wyoung
|
164 |
|
|
282402d…
|
wyoung
|
165 |
|
|
282402d…
|
wyoung
|
166 |
<h2 id="timeout">timeout: <i>N</i></h2> |
|
282402d…
|
wyoung
|
167 |
|
|
282402d…
|
wyoung
|
168 |
This property changes the timeout on each CGI request to N seconds. |
|
282402d…
|
wyoung
|
169 |
If N is zero, then there is no timeout. If this property is omitted, |
|
282402d…
|
wyoung
|
170 |
then the default timeout is 300 seconds (5 minutes). |
|
282402d…
|
wyoung
|
171 |
|
|
fbc3b2f…
|
drh
|
172 |
|
|
fbc3b2f…
|
drh
|
173 |
<h2 id="extroot">extroot: <i>PATH</i></h2> |
|
fbc3b2f…
|
drh
|
174 |
|
|
fbc3b2f…
|
drh
|
175 |
This property defines the DOCUMENT_ROOT for the |
|
fbc3b2f…
|
drh
|
176 |
[./serverext.wiki|CGI Server Extensions]. If this property |
|
fbc3b2f…
|
drh
|
177 |
is present, then CGI Server Extensions are enabled. When this |
|
fbc3b2f…
|
drh
|
178 |
property is omitted, CGI Server Extensions are disabled. |
|
fbc3b2f…
|
drh
|
179 |
|
|
fbc3b2f…
|
drh
|
180 |
A cascade of CGI invocations can occur here. Fossil itself is |
|
fbc3b2f…
|
drh
|
181 |
started as CGI, then Fossil can turn around and invoke a sub-CGI |
|
fbc3b2f…
|
drh
|
182 |
extension. The sub-CGI extension outputs reply text, when Fossil |
|
fbc3b2f…
|
drh
|
183 |
then (optionally) augments with its own header and footer and returns |
|
fbc3b2f…
|
drh
|
184 |
to the original requestor. The property controls the DOCUMENT_ROOT |
|
fbc3b2f…
|
drh
|
185 |
of the sub-CGI. |
|
fbc3b2f…
|
drh
|
186 |
|
|
282402d…
|
wyoung
|
187 |
|
|
282402d…
|
wyoung
|
188 |
<h2 id="redirect">redirect: <i>REPO URL</i></h2> |
|
282402d…
|
wyoung
|
189 |
|
|
282402d…
|
wyoung
|
190 |
Extract the "name" query parameter and search REPO for a check-in or |
|
282402d…
|
wyoung
|
191 |
ticket that matches the value of "name", then redirect to URL. There |
|
282402d…
|
wyoung
|
192 |
can be multiple "redirect:" lines that are processed in order. If the |
|
282402d…
|
wyoung
|
193 |
repo name is "*", then an unconditional redirect to URL is taken. |
|
282402d…
|
wyoung
|
194 |
|
|
282402d…
|
wyoung
|
195 |
|
|
282402d…
|
wyoung
|
196 |
<h2 id="jsmode">jsmode: <i>VALUE</i></h2> |
|
282402d…
|
wyoung
|
197 |
|
|
c64f28d…
|
drh
|
198 |
Specifies the delivery mode for JavaScript files. See "[/help/http | |
|
282402d…
|
wyoung
|
199 |
http --jsmode]" for the allowed values and their meanings. |
|
282402d…
|
wyoung
|
200 |
|
|
73ca280…
|
drh
|
201 |
|
|
73ca280…
|
drh
|
202 |
<h2 id="mainmenu">mainmenu: <i>FILE</i></h2> |
|
73ca280…
|
drh
|
203 |
|
|
73ca280…
|
drh
|
204 |
This parameter causes the contents of the given file to override the |
|
efd79f8…
|
drh
|
205 |
site's <tt>mainmenu</tt> configuration setting, in much the same way |
|
73ca280…
|
drh
|
206 |
that the <tt>skin</tt> setting overrides the skin. This can be used to |
|
73ca280…
|
drh
|
207 |
apply a common main menu to a number of sites, and centrally maintain |
|
73ca280…
|
drh
|
208 |
it, without having to copy its contents into each site. Note, however, |
|
73ca280…
|
drh
|
209 |
that the contents of this setting are not stored in the repository and |
|
73ca280…
|
drh
|
210 |
will not be cloned along with the repository. |