aboutsummaryrefslogtreecommitdiff
path: root/roles/cosmos/templates/nginx.conf.j2
blob: 98879acd477859037fd98c73d79b78b4fef84708 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# -*- Nginx -*-
# {{ ansible_managed }}

server {
    listen      80;
    listen [::]:80;
    server_name cosmos.party
            www.cosmos.party
            git.cosmos.party
          lists.cosmos.party
           andr.cosmos.party;

    location ^~ /.well-known/acme-challenge/ {
        root /var/www/acme;
    }

    location / {
        return 307 https://$host$request_uri;
    }
}

server {
    server_name cosmos.party
            www.cosmos.party;

    listen unix:/var/run/nginx/http.sock;
    listen      443 ssl;
    listen [::]:443 ssl;
    listen      443 quic;
    listen [::]:443 quic;

    http2 on;
    http3 on;

    add_header Alt-Svc 'h3=":443"; ma=86400';

    ssl_certificate /etc/ssl/cosmos.party.fullchain.pem;
    ssl_certificate_key /etc/ssl/private/cosmos.party.key;
    ssl_protocols TLSv1.2 TLSv1.3;

    root /srv/http/cosmos.party;
    index index.html;

    location /en/ { try_files $uri $uri/ =404; }
    location /ru/ { try_files $uri $uri/ =404; }
    location /sk/ { try_files $uri $uri/ =404; }
    location /    { try_files $uri /en$uri /en$uri/ =404; }
}

server {
    server_name git.cosmos.party;

    listen unix:/var/run/nginx/http.sock;
    listen      443 ssl;
    listen [::]:443 ssl;
    listen      443 quic;
    listen [::]:443 quic;

    http2 on;
    http3 on;

    add_header Alt-Svc 'h3=":443"; ma=86400';

    ssl_certificate /etc/ssl/cosmos.party.fullchain.pem;
    ssl_certificate_key /etc/ssl/private/cosmos.party.key;
    ssl_protocols TLSv1.2 TLSv1.3;

    location ~ /.+/(info/refs|git-upload-pack) {
        include /etc/nginx/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/repositories/;
        fastcgi_pass unix:/var/run/cgit.sock-1;
    }

    root /srv/http/git.cosmos.party/;
    try_files $uri @cgit-static;

    location @cgit-static {
        root /usr/share/webapps/cgit/;
        try_files $uri @cgit;
    }

    location @cgit {
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME /usr/share/webapps/cgit/cgit.cgi;
        fastcgi_param CGIT_CONFIG /etc/cgitrc-cosmos;
        fastcgi_param PATH_INFO $uri;
        fastcgi_param QUERY_STRING $args;
        fastcgi_param HTTP_HOST $server_name;
        fastcgi_pass unix:/var/run/cgit.sock-1;
    }
}

server {
    server_name andr.cosmos.party;


    listen unix:/var/run/nginx/http.sock;
    listen      443 ssl;
    listen [::]:443 ssl;
    listen      443 quic;
    listen [::]:443 quic;

    http2 on;
    http3 on;

    ssl_certificate /etc/ssl/cosmos.party.fullchain.pem;
    ssl_certificate_key /etc/ssl/private/cosmos.party.key;
    ssl_protocols TLSv1.2 TLSv1.3;

    add_header Alt-Svc 'h3=":443"; ma=86400';

    root /srv/http/$host;
    autoindex on;
}