forked from pryv/open-pryv.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsite.conf
65 lines (54 loc) · 1.76 KB
/
site.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
upstream core_server {
# api hostfrom docker compose and max_fails , should be changed for production OVERRIDE ME
server open-pryv.io:3000 max_fails=10 fail_timeout=30s;
}
upstream websocket_server {
# api hostfrom docker compose and max_fails , should be changed for production OVERRIDE ME
server open-pryv.io:3000 max_fails=10 fail_timeout=30s;
}
# API (Core)
server {
# redirect from http to https
listen 80 default_server;
server_name ${HOSTNAME};
location /.well-known/acme-challenge/ {
root /var/www/certbot;
}
location / {
return 301 https://$host$request_uri;
}
}
server {
# redirect from www to without www
server_name www.${HOSTNAME};
return 301 $scheme://${HOSTNAME}$request_uri;
}
server {
listen 443 ssl;
# set server name from env variables (set in docker compose)
server_name ${HOSTNAME};
client_max_body_size 20M;
### Proxy options (has to be within server definition to be effective)
# This enables websocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_redirect off;
proxy_buffering off;
proxy_buffers 16 8k;
# User information will be in the host, so proxy that as well.
set $my_host $http_host;
proxy_set_header Host $my_host;
location / {
proxy_pass http://core_server;
}
# Socket.IO: Handshakes will be done against a specific backend
# process and will not be valid on other backend processes. We cannot load
# balance this the same way as other calls.
location /socket.io/ {
proxy_pass http://websocket_server;
}
}