Redirect the http root to the repo index

This commit is contained in:
Sameer Rahmani 2023-07-17 00:56:29 +01:00
parent c7fa8cd591
commit 5563d89934
Signed by: lxsameer
GPG Key ID: B0A4AF28AB9FD90B
2 changed files with 19 additions and 18 deletions

View File

@ -20,7 +20,7 @@ logo=/cgit.png
robots=noindex, nofollow robots=noindex, nofollow
# if cgit messes up links, use a virtual-root. For example, cgit.example.org/ has this value: # if cgit messes up links, use a virtual-root. For example, cgit.example.org/ has this value:
virtual-root=/ virtual-root=/git
enable-commit-graph=1 enable-commit-graph=1
enable-index-links=1 enable-index-links=1
enable-log-linecount=1 enable-log-linecount=1
@ -31,6 +31,8 @@ root-title=TITEL
root-desc=DESC root-desc=DESC
remove-suffix=1 remove-suffix=1
repo.url=repo repo.url=repo
repo.path=/repo repo.path=/repo
repo.desc=This is my git repository repo.desc=This is my git repository
repo.snapshots=0

View File

@ -1,21 +1,20 @@
server.modules += ( "mod_cgi", "mod_alias" ) server.modules += ( "mod_cgi", "mod_alias", "mod_rewrite", "mod_redirect" )
var.cgit-root = "/usr/share/webapps/cgit" $HTTP["url"] =~ "^/$" {
url.redirect = ( "^/(.*)" => "/git/repo$1")
}
$HTTP["host"] =~ ".*" { $HTTP["url"] =~ "^/cgit" {
server.document-root = "/usr/share/webapps/cgit/"
server.indexfiles = ("cgit.cgi")
cgi.assign = ("cgit.cgi" => "")
mimetype.assign = ( ".css" => "text/css" )
}
alias.url = ( alias.url += (
"/cgit.css" => cgit-root + "/cgit.css", "/git" => "/usr/share/webapps/cgit/cgit.cgi",
"/cgit.png" => cgit-root + "/cgit.png", )
"/favicon.ico" => cgit-root + "/favicon.ico", $HTTP["url"] =~ "^/git" {
"/" => cgit-root + "/cgit.cgi" cgi.assign = ( "" => "" )
)
cgi.assign = (".cgi" => "") }
url.rewrite-once = (
"^/cgit\.(css|png)" => "$0",
"/favicon.ico" => "$0",
"^/.+" => "/cgit.cgi$0",
)
}