Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 3813a33

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent fdae191 commit 3813a33

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

Documentation/git-http-backend.txt

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,61 @@ ScriptAliasMatch \
167167
ScriptAlias /git/ /var/www/cgi-bin/gitweb.cgi/
168168
----------------------------------------------------------------
169169

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+
170225

171226
ENVIRONMENT
172227
-----------

0 commit comments

Comments
 (0)