1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# An nginx server block that serves cgit at the root of git.example.org.
# Include it from the http block of nginx.conf, which supplies the user, the
# MIME types and the logs. nginx cannot run CGI programs itself, so it hands
# them to fcgiwrap over the socket listed below.
#
# The paths are one common layout, so adjust them to your system.
# cgit.cgi /usr/lib/cgit, from make install with the two-line cgit.conf in README
# static files /usr/share/cgit, from the same install
# fcgiwrap socket /run/fcgiwrap.socket
# repositories /var/lib/git, the scan-path custom/cgitrc suggests
# git-http-backend /usr/libexec/git-core, the directory git --exec-path prints
# certificate /etc/ssl/certs/git.example.org.pem
# key /etc/ssl/private/git.example.org.key
#
# The commented examples add HTTPS, which the bundled auth filters need
# before they log anyone in, and smart HTTP clone and push through
# git-http-backend.
server {
listen 80;
listen [::]:80;
server_name git.example.org;
# HTTPS on 443 beside plain HTTP.
#listen 443 ssl;
#listen [::]:443 ssl;
#ssl_certificate /etc/ssl/certs/git.example.org.pem;
#ssl_certificate_key /etc/ssl/private/git.example.org.key;
# Sends plain HTTP on to HTTPS.
#if ($scheme = http) {
# return 301 https://$host$request_uri;
#}
root /usr/share/cgit;
# The five files cgit links to at the root are served off disk. They are
# matched by their full names, so a repository file such as
# /demo/tree/cgit.css still goes to cgit.
location ~ ^/(cgit\.css|cgit\.js|cgit\.png|favicon\.ico|robots\.txt)$ {
}
# Smart HTTP clone and push at the urls cgit gives the repositories go to
# git-http-backend. It finds them under GIT_PROJECT_ROOT and, with
# GIT_HTTP_EXPORT_ALL, serves them without a git-daemon-export-ok file.
# The safe.directory setting lets it open them while another user owns
# them. Push is refused until a repository sets http.receivepack or the
# server authenticates the user, and nginx's 1m limit on a request body
# is lifted for it.
#location ~ ^/.+/(info/refs|git-upload-pack|git-receive-pack)$ {
# client_max_body_size 0;
# include fastcgi_params;
# fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;
# fastcgi_param PATH_INFO $uri;
# fastcgi_param GIT_PROJECT_ROOT /var/lib/git;
# fastcgi_param GIT_HTTP_EXPORT_ALL "";
# fastcgi_param GIT_CONFIG_COUNT 1;
# fastcgi_param GIT_CONFIG_KEY_0 safe.directory;
# fastcgi_param GIT_CONFIG_VALUE_0 *;
# fastcgi_pass unix:/run/fcgiwrap.socket;
#}
# Everything else goes to cgit. fastcgi_params passes the query string
# and takes SCRIPT_NAME from the first group of the split, which is
# empty, so cgit's links start at the root. The second group is the whole
# path, which cgit reads as PATH_INFO.
location / {
fastcgi_split_path_info ^()(.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME /usr/lib/cgit/cgit.cgi;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_pass unix:/run/fcgiwrap.socket;
}
}
|