-
Notifications
You must be signed in to change notification settings - Fork 1
/
default.conf.tpl
92 lines (70 loc) · 2.13 KB
/
default.conf.tpl
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
upstream platform {
server ${PLATFORM_HOST}:${PLATFORM_PORT};
}
upstream broker-websocket {
server ${BROKER_HOST}:${BROKER_PORT};
}
server {
listen 80 default_server;
listen [::]:80 default_server;
# Redirect all HTTP requests to HTTPS with a 301 Moved Permanently response.
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2 default_server;
listen [::]:443 ssl http2 default_server;
# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate ${TLS_CERT};
ssl_certificate_key ${TLS_CERT_KEY};
# verify chain of trust of OCSP response using Root CA and Intermediate certs
ssl_trusted_certificate ${TLS_CERT_ROOT};
# rest of ssl config
include includes/ssl.conf;
# redirect all traffic for unknown subdomains to main domain
return 301 https://${TLD};
}
# api.${TLD}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate ${TLS_CERT};
ssl_certificate_key ${TLS_CERT_KEY};
# verify chain of trust of OCSP response using Root CA and Intermediate certs
ssl_trusted_certificate ${TLS_CERT_ROOT};
# rest of ssl config
include includes/ssl.conf;
server_name api.${TLD};
root /var/www;
location / {
proxy_pass http://platform;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
}
location /broker {
return 403;
}
}
# rtm.${TLD}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
# certs sent to the client in SERVER HELLO are concatenated in ssl_certificate
ssl_certificate ${TLS_CERT};
ssl_certificate_key ${TLS_CERT_KEY};
# verify chain of trust of OCSP response using Root CA and Intermediate certs
ssl_trusted_certificate ${TLS_CERT_ROOT};
# rest of ssl config
include includes/ssl.conf;
server_name rtm.${TLD};
root /var/www;
location /mqtt {
proxy_pass http://broker-websocket/mqtt;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
location / {
return 301 https://${TLD};
}
}