-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmatrix.mydomain.vpn
More file actions
105 lines (65 loc) · 2.31 KB
/
Copy pathmatrix.mydomain.vpn
File metadata and controls
105 lines (65 loc) · 2.31 KB
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
#### ELEMENT CLIENT (Port 8000) ####
server {
listen 8000 ssl;
listen [::]:8000 ssl;
include /usr/local/etc/nginx/ssl.conf;
server_name matrix.mydomain.vpn;
root /data/local/www/matrix.mydomain.vpn/element;
index index.html index.php index.htm index.nginx-debian.html;
location / {
# Prevent caching of Element in the browser
add_header Cache-Control 'no-store';
add_header Cache-Control 'no-cache';
expires 0;
# First attempt to serve request as file, then as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Content-Security-Policy "frame-ancestors 'none'";
access_log /var/log/nginx/matrix.mydomain.vpn-8000-access.log;
error_log /var/log/nginx/matrix.mydomain.vpn-8000-error.log;
}
#### SYNAPSE SERVER PROXY (Port 80 : 8008) ####
server {
listen 80;
server_name matrix.mydomain.vpn;
location = / {
return 301 https://$host$request_uri; #_matrix/client/#/login;
}
location /_matrix {
proxy_pass http://127.0.0.1:8008;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
#### SYNAPSE SERVER PROXY (Port 443 : 8448) ####
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
# For the federation port
listen 8448 ssl http2;
listen [::]:8448 ssl http2;
include /usr/local/etc/nginx/ssl.conf;
server_name matrix.mydomain.vpn;
location ~ ^(/_matrix|/_synapse/client) {
proxy_pass http://127.0.0.1:8008;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
# 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;
# Synapse responses may be chunked, which is an HTTP/1.1 feature.
proxy_http_version 1.1;
}
location /.well-known/matrix/client {
return 200 '{"m.homeserver": {"base_url": "https://matrix.mydomain.vpn"}}';
default_type application/json;
add_header Access-Control-Allow-Origin *;
}
location /.well-known/matrix/server {
return 200 '{"m.server": "matrix.mydomain.vpn:443"}';
default_type application/json;
}
}