doc/http-backend: give some lighttpd config examples
The examples in the documentation are all for Apache. Let's at least cover the basics: an anonymous server, an authenticated server, and a "half auth" server with anonymous read and authenticated write. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Apr 10, 2013 at 23:36 UTC
3813a33de5f9e8224eb2bd2ebae167b3bb00ef73
1 file changed
+55
Documentation/git-http-backend.txt
+55
@@ -167,6 +167,61 @@ ScriptAliasMatch \
167
ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/
168
----------------------------------------------------------------
169
170
+Lighttpd::
171
+ Ensure that `mod_cgi`, `mod_alias, `mod_auth`, `mod_setenv` are
172
+ loaded, then set `GIT_PROJECT_ROOT` appropriately and redirect
173
+ all requests to the CGI:
174
++
175
+----------------------------------------------------------------
176
+alias.url += ( "/git" => "/usr/lib/git-core/git-http-backend" )
177
+$HTTP["url"] =~ "^/git" {
178
+ cgi.assign = ("" => "")
179
+ setenv.add-environment = (
180
+ "GIT_PROJECT_ROOT" => "/var/www/git",
181
+ "GIT_HTTP_EXPORT_ALL" => ""
182
+ )
183
+}
184
+----------------------------------------------------------------
185
++
186
+To enable anonymous read access but authenticated write access:
187
++
188
+----------------------------------------------------------------
189
+$HTTP["querystring"] =~ "service=git-receive-pack" {
190
+ include "git-auth.conf"
191
+}
192
+$HTTP["url"] =~ "^/git/.*/git-receive-pack$" {
193
+ include "git-auth.conf"
194
+}
195
+----------------------------------------------------------------
196
++
197
+where `git-auth.conf` looks something like:
198
++
199
+----------------------------------------------------------------
200
+auth.require = (
201
+ "/" => (
202
+ "method" => "basic",
203
+ "realm" => "Git Access",
204
+ "require" => "valid-user"
205
+ )
206
+)
207
+# ...and set up auth.backend here
208
+----------------------------------------------------------------
209
++
210
+Note that unlike the similar setup with Apache, we can easily match the
211
+query string for receive-pack, catching the initial request from the
212
+client. This means that the server administrator does not have to worry
213
+about configuring `http.receivepack` for the repositories (the default
214
+value, which enables it only in the case of authentication, is
215
+sufficient).
216
++
217
+To require authentication for both reads and writes:
218
++
219
+----------------------------------------------------------------
220
+$HTTP["url"] =~ "^/git/private" {
221
+ include "git-auth.conf"
222
+}
223
+----------------------------------------------------------------
224
+
225
226
ENVIRONMENT
227
-----------