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
#
# !!! This file is managed by Ansible !!!
#
{% if services.cgit.nginx.sslOnly is not defined or services.cgit.nginx.sslOnly is false %}
server {
listen 80 ;
listen [::]:80;
server_name {{ services.cgit.nginx.domain }};
root /usr/share/webapps/cgit;
try_files $uri @cgit;
location @cgit {
include fastcgi_params;
fastcgi_pass 127.0.0.1:8001;
fastcgi_param SCRIPT_FILENAME /usr/share/webapps/cgit/cgit.cgi;
fastcgi_param PATH_INFO $uri;
fastcgi_param QUERY_STRING $args;
}
}
{% endif %}
{% if services.cgit.nginx.ssl.enable is true %}
server {
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate "{{ services.cgit.nginx.ssl.cert }}";
ssl_certificate_key "{{ services.cgit.nginx.ssl.privkey }}";
include /etc/nginx/ssl.conf;
server_name {{ services.cgit.nginx.domain }};
root /usr/share/webapps/cgit;
location ~ "^/[a-zA-Z0-9._-]+/(git-(receive|upload)-pack|HEAD|info/refs|objects/(info/(http-)?alternates|packs)|[0-9a-f]{2}/[0-9a-f]{38}|pack/pack-[0-9a-f]{40}\.(pack|idx))$" {
if ($query_string = service=git-receive-pack) {
return 403;
}
client_max_body_size 0;
include fastcgi_params;
fastcgi_pass 127.0.0.1:8001;
fastcgi_param SCRIPT_FILENAME /usr/libexec/git-core/git-http-backend;
fastcgi_param GIT_PROJECT_ROOT /var/lib/git/repositories;
fastcgi_param PATH_INFO $fastcgi_script_name;
}
try_files $uri @cgit;
location @cgit {
include fastcgi_params;
fastcgi_pass 127.0.0.1:8001;
fastcgi_param SCRIPT_FILENAME /usr/share/webapps/cgit/cgit.cgi;
fastcgi_param PATH_INFO $uri;
fastcgi_param QUERY_STRING $args;
}
}
{% endif %}