summaryrefslogtreecommitdiff
path: root/public/fs/etc/nginx/vhosts.d/git.foss21.org.conf
blob: 8205e6eeed5b3bb1c5fd237dd73d653a6ad455eb (plain)
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
server {
    listen                [::]:80;
    server_name           git.foss21.org;
    return                301 https://$server_name$request_uri;
}

server {
    listen                [::]:443;
    server_name           git.foss21.org;
    root                  /srv/www/htdocs;

    # legacy (bookmarked) /cgit.git addresses
    location /cgit.cgi {
        rewrite           ^/cgit.cgi(/.*)$ $1 last;
    }

    # git-http-backend: initial clone GET request
    location ~ ^(/namespace)?/(.+?)/info(/.*)?$ {
        try_files         $uri @git_http_backend;
    }

    # git-http-backend: clone POST request
    location ~ ^(/namespace)?/(.+?)/git-upload-pack {
        try_files         $uri @git_http_backend;
    }

    # otherwise, cgit
    location / {
        try_files         $uri @cgit;
    }

    location @git_http_backend {
        include           uwsgi_params;
        uwsgi_modifier1   9;
        uwsgi_pass        unix:/run/uwsgi/git.socket;

        uwsgi_param       HTTP_HOST             $server_name;
        uwsgi_param       GIT_PROJECT_ROOT      /srv/git;
        uwsgi_param       PATH_INFO             $uri;
        uwsgi_param       GIT_HTTP_EXPORT_ALL   "";
    }

    location @cgit {
        include           uwsgi_params;
        uwsgi_modifier1   9;
        uwsgi_pass        unix:/run/uwsgi/cgit.socket;

        uwsgi_param       HTTP_HOST       $server_name;
        uwsgi_param       CGIT_CONFIG     /etc/cgit.d/cgitrc.foss21.org;
        uwsgi_param       SCRIPT_FILENAME $document_root/cgit.cgi;
        uwsgi_param       PATH_INFO       $uri;
        uwsgi_param       QUERY_STRING    $args;
    }

    ssl_certificate           /home/webroot/foss21.org/ssl/fullchain.pem;
    ssl_certificate_key       /home/webroot/foss21.org/ssl/privkey.pem;
    ssl_trusted_certificate   /home/webroot/foss21.org/ssl/chain.pem;

    include conf.d/ssl_params;
}