aboutsummaryrefslogtreecommitdiff
path: root/services/docker/git-server/app/lighttpd/lighttpd.conf
diff options
context:
space:
mode:
authorYuqian Yang <crupest@crupest.life>2025-03-07 19:15:31 +0800
committerYuqian Yang <crupest@crupest.life>2025-03-07 19:44:36 +0800
commit91690b59663b89bbc3d8c7febe2b046de1424672 (patch)
tree7dbd70ca6ede7f03925b371726246cfa327e1e71 /services/docker/git-server/app/lighttpd/lighttpd.conf
parentcb6c8080bc6c6e262a73a8d1c0d21e12ebc3906a (diff)
downloadcrupest-91690b59663b89bbc3d8c7febe2b046de1424672.tar.gz
crupest-91690b59663b89bbc3d8c7febe2b046de1424672.tar.bz2
crupest-91690b59663b89bbc3d8c7febe2b046de1424672.zip
fix(git): public/private repo problem, enable cgit for private.
Diffstat (limited to 'services/docker/git-server/app/lighttpd/lighttpd.conf')
-rw-r--r--services/docker/git-server/app/lighttpd/lighttpd.conf57
1 files changed, 57 insertions, 0 deletions
diff --git a/services/docker/git-server/app/lighttpd/lighttpd.conf b/services/docker/git-server/app/lighttpd/lighttpd.conf
new file mode 100644
index 0000000..a96a778
--- /dev/null
+++ b/services/docker/git-server/app/lighttpd/lighttpd.conf
@@ -0,0 +1,57 @@
+server.modules += ("mod_accesslog")
+server.modules += ("mod_rewrite")
+server.modules += ("mod_auth", "mod_authn_file", "mod_access")
+server.modules += ("mod_alias", "mod_setenv", "mod_cgi")
+
+server.port = 3636
+server.document-root = "/var/www/html/"
+accesslog.filename = "/dev/fd/3"
+server.breakagelog = "/dev/fd/4"
+
+$HTTP["url"] =^ "/git" {
+ mimetype.assign = ( ".css" => "text/css" )
+
+ $HTTP["url"] =^ "/git/private" {
+ include "auth.conf"
+ }
+
+ $HTTP["url"] =~ "^/git/.*/(HEAD|info/refs|objects/info/[^/]+|git-(upload|receive)-pack)$" {
+ url.rewrite-once = (
+ "^/git/private" => "$0",
+ "^/git(.*)" => "/git/public$1"
+ )
+
+ $HTTP["querystring"] =~ "service=git-receive-pack" {
+ include "auth.conf"
+ }
+ $HTTP["url"] =~ "^/git/.*/git-receive-pack$" {
+ include "auth.conf"
+ }
+ alias.url += ( "/git" => "/usr/lib/git-core/git-http-backend" )
+ setenv.add-environment = (
+ "GIT_PROJECT_ROOT" => "/git/repos",
+ "GIT_HTTP_EXPORT_ALL" => ""
+ )
+ cgi.assign = ("" => "")
+ }
+ else $HTTP["url"] =~ "^/git/.*/((objects/[0-9a-f]{2}/[0-9a-f]{38})|(pack/pack-[0-9a-f]{40}.(pack|idx)))$" {
+ alias.url += (
+ "/git/private" => "/git/repos/private",
+ "/git" => "/git/repos/public",
+ )
+ }
+ else $HTTP["url"] =^ "/git/static" {
+ alias.url += (
+ "/git/static" => "/usr/share/cgit",
+ )
+ }
+ else {
+ alias.url += (
+ "/git" => "/usr/lib/cgit/cgit.cgi",
+ )
+ setenv.add-environment = (
+ "CGIT_CONFIG" => "/app/cgit/cgitrc"
+ )
+ cgi.assign = ("" => "")
+ }
+}