-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.server.example.conf
More file actions
51 lines (46 loc) · 1.8 KB
/
Copy pathnginx.server.example.conf
File metadata and controls
51 lines (46 loc) · 1.8 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
# Reverse-proxy config for the shared nginx container on the host.
#
# Copy to the running nginx container's conf.d and reload, e.g.:
# docker cp nginx.conf nginx:/etc/nginx/conf.d/persistent.conf
# docker exec nginx nginx -s reload
#
# Replace persistent.example.com with your domain. TLS is terminated upstream
# (e.g. Cloudflare) and traffic reaches nginx over HTTP:80; the API trusts
# X-Forwarded-Proto for secure cookies. The `persistent-api` upstream is the
# api container (compose.server.yml container_name) on the shared nginx_default
# network.
server {
server_name persistent.example.com;
listen 80;
# Docker's embedded DNS, so the upstream resolves even if the api restarts.
resolver 127.0.0.11 valid=30s;
proxy_buffering off;
client_max_body_size 10m;
# WebSocket endpoint for live updates.
location /ws {
set $upstream persistent-api;
proxy_pass http://$upstream:4000;
proxy_http_version 1.1;
proxy_set_header Host $host;
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 $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 1h;
proxy_send_timeout 1h;
proxy_redirect off;
}
location / {
set $upstream persistent-api;
proxy_pass http://$upstream:4000;
proxy_http_version 1.1;
proxy_set_header Host $host;
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 $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_redirect off;
}
}