forked from spantaleev/matrix-docker-ansible-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrix.conf
96 lines (80 loc) · 3.67 KB
/
matrix.conf
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
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
# TODO: add/remove services and their subdomains if you use/don't use them
# this example is using hosting something on the base domain and an element web client, so example.com and element.example.com are listed in addition to matrix.example.com
# if you don't use those, you can remove them
# if you use e.g. dimension on dimension.example.com, add dimension.example.com to the server_name list
server_name example.com matrix.example.com element.example.com;
location / {
# note: do not add a path (even a single /) after the port in `proxy_pass`,
# otherwise, nginx will canonicalise the URI and cause signature verification
# errors.
proxy_pass http://localhost:81;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
access_log /var/log/nginx/matrix.access.log;
error_log /var/log/nginx/matrix.error.log;
# Nginx by default only allows file uploads up to 1M in size
# Increase client_max_body_size to match max_upload_size defined in homeserver.yaml
client_max_body_size 50M;
}
# TODO: adapt the path to your ssl certificate for the domains listed on server_name
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
# TODO: adapt the path to your ssl certificate for the domains listed on server_name
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
# settings for matrix federation
server {
# For the federation port
listen 8448 ssl http2 default_server;
listen [::]:8448 ssl http2 default_server;
server_name matrix.example.com;
location / {
proxy_pass http://localhost:8449;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
access_log /var/log/nginx/matrix.access.log;
error_log /var/log/nginx/matrix.error.log;
# Nginx by default only allows file uploads up to 1M in size
# Increase client_max_body_size to match max_upload_size defined in homeserver.yaml
client_max_body_size 50M;
}
# TODO: adapt the path to your ssl certificate for the domains listed on server_name
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
# TODO: adapt the path to your ssl certificate for the domains listed on server_name
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
# ensure using https
# TODO: remove server blocks that you don't use / add server blocks for domains you do use
server {
if ($host = example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name example.com;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = matrix.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name matrix.example.com;
listen 80;
return 404; # managed by Certbot
}
server {
if ($host = element.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
server_name element.example.com;
listen 80;
return 404; # managed by Certbot
}