aboutsummaryrefslogtreecommitdiff
path: root/ansible/roles/synapse/templates/matrix-nginx.conf.j2
blob: 38e49cef73964c94b477756bd0172fa1af80fae9 (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
server {
    listen 80;
    server_name matrix.{{ matrix_server_name }};
	include /etc/nginx/snippets/letsencrypt.conf;
    return 301 https://matrix.{{ matrix_server_name }}/$request_uri;
}

server {
    listen 8448 ssl http2 default_server;
    listen [::]:8448 ssl http2 default_server;
    server_name matrix.{{ matrix_server_name }};
	include /etc/nginx/snippets/ssl.conf;

    ssl_certificate /etc/ssl/uacme/matrix.{{ matrix_server_name }}/cert.pem;
    ssl_certificate_key /etc/ssl/uacme/private/matrix.{{ matrix_server_name }}/key.pem;

    # proxy synapse
    location / {
        proxy_pass http://localhost:8008;
        proxy_set_header X-Forwarded-For $remote_addr;
    }
}

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name matrix.{{ matrix_server_name }};
	include /etc/nginx/snippets/ssl.conf;

    ssl_certificate /etc/ssl/uacme/matrix.{{ matrix_server_name }}/cert.pem;
    ssl_certificate_key /etc/ssl/uacme/private/matrix.{{ matrix_server_name }}/key.pem;

    client_max_body_size 10M;

    # redirect curious web users to the service page for matrix
    location / {
        return 301 https://cyberia.club/;
    }

    # proxy synapse
    location /_matrix {
        proxy_pass http://localhost:8008;
        proxy_set_header X-Forwarded-For $remote_addr;
    }

    # proxy metrics
    location /_synapse/metrics {
        proxy_pass http://localhost:8008/_synapse/metrics;
        proxy_set_header X-Forwarded-For $remote_addr;
    }
}