-
Notifications
You must be signed in to change notification settings - Fork 13
/
nginx.dev.conf
57 lines (51 loc) · 1.91 KB
/
nginx.dev.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
http {
# Run nginx with "npm run start-production"
# Stop nginx with "npm run stop-production"
# Reload nginx without stopping server "npm reload-production"
#logging
access_log /var/log/nginx/sce.access.log;
# when we run docker-compose up for the first time, a default
# network is created that all the containers are attached to.
# this default network name is the directory name + "_default".
# As a result, the network name will be "clark_default".
# To establish a connection to the containers, we can do
# <container name>.<network name>, and that's what happens below.
upstream webserver {
server sce-frontend-dev.clark_default:3000;
}
upstream main_endpoints {
server sce-main-endpoints-dev.clark_default:8080;
}
upstream sce-cloud-api {
server sce-cloud-api-dev.clark_default:8082;
}
# actual nginx server
server {
listen 80;
#Load balancer
location /api {
proxy_pass http://main_endpoints;
}
location /cloudapi {
proxy_pass http://sce-cloud-api;
}
# see https://stackoverflow.com/a/59816181
location /sockjs-node {
proxy_pass http://webserver;
proxy_redirect default;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
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-Host $server_name;
# the following two timeout rules fix CRA WDS disconnects after 60s
proxy_read_timeout 86400s;
proxy_send_timeout 86400s;
}
location / {
proxy_pass http://webserver;
}
}
}
events { }