aboutsummaryrefslogtreecommitdiffstats
path: root/roles/web/templates/sites/liwt.cgit.conf.j2
blob: 50f61dbb5e908ad6cecfd8fdb14c6e4991c03cbe (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
{% set domain = "liwt.net" %}
#
# nginx/sites: liwt.cgit.conf
# Website: git.{{ domain }}
# Share/publish projects (git repositories) using `cgit`.
#
# Refernce:
# [1] ArchWiki - cgit
#     https://wiki.archlinux.org/index.php/Cgit
#
#
# Aaron LI
# 2017-06-18
#

{% if git.cgit is defined and domains_hascert[domain] %}
server {
    listen            443 ssl http2;
    listen       [::]:443 ssl http2;
    server_name  git.{{ domain }};

    # SSL/TLS Certificate kindly provided by Let's Encrypt
    ssl_certificate      /usr/local/etc/ssl/acme/{{ domain }}/fullchain.pem;
    ssl_certificate_key  /usr/local/etc/ssl/acme/private/{{ domain }}.pem;

    # Projects (git repositories) location
    root         /usr/local/www/cgit;
    try_files    $uri @cgit;

    location @cgit {
        include          uwsgi_params;
        # modifier1: 9 - size of CGI block vars (HTTP request body excluded)
        uwsgi_modifier1  9;
        uwsgi_pass       unix:/tmp/uwsgi-cgit.sock;
    }

    location /static/ {
        root  {{ git.cgit.root }};
    }

    error_page  500 502 503 504 /50x.html;
    location = /50x.html {
        root  /usr/local/www/nginx-dist;
    }
}
{% endif %}