summaryrefslogtreecommitdiff
path: root/roles/apps/etherpad-lite/templates/nginx-vhost.conf.j2
blob: b59701fc273396a8082864ea6d093ab20988fb9a (plain) (blame)
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
server {
    listen 80;
    listen [::]:80;
    server_name {{ item.value.hostnames | join(' ') }};

    include snippets/acmetool.conf;

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

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name {{ item.value.hostnames | join(' ') }};

    include snippets/acmetool.conf;
    include snippets/tls.conf;
    ssl_certificate     /var/lib/acme/live/{{ item.value.hostnames[0] }}/fullchain;
    ssl_certificate_key /var/lib/acme/live/{{ item.value.hostnames[0] }}/privkey;
    include snippets/hsts.conf;

    location / {
        rewrite ^/$ / break;
        rewrite ^/locales/(.*) /locales/$1 break;
        rewrite ^/locales.json /locales.json break;
        rewrite ^/admin(.*) /admin$1 break;
        rewrite ^/p/(.*) /p/$1 break;
        rewrite ^/static/(.*) /static/$1 break;
        rewrite ^/pluginfw/(.*) /pluginfw/$1 break;
        rewrite ^/javascripts/(.*) /javascripts/$1 break;
        rewrite ^/socket.io/(.*) /socket.io/$1 break;
        rewrite ^/ep/(.*) /ep/$1 break;
        rewrite ^/minified/(.*) /minified/$1 break;
        rewrite ^/api/(.*) /api/$1 break;
        rewrite ^/ro/(.*) /ro/$1 break;
        rewrite ^/error/(.*) /error/$1 break;
        rewrite ^/jserror(.*) /jserror$1 break;
        rewrite ^/redirect(.*) /redirect$1 break;
        rewrite /favicon.ico /favicon.ico break;
        rewrite /robots.txt /robots.txt break;
        rewrite /(.*) /p/$1;

        include snippets/proxy-nobuff.conf;

        proxy_set_header Host $host;
        include snippets/proxy-forward-headers.conf;
        proxy_pass_header Server;

        # for websockets
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;

        proxy_pass http://127.0.0.1:{{ item.value.port }};
    }
}