Skip to content

Commit 605d80b

Browse files
authored
Merge pull request #7085 from BacLuc/nginx-retry
reverse-proxy-nginx.conf: use upstreams for the proxy_pass directives
2 parents 388591e + 2e2bcce commit 605d80b

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

reverse-proxy-nginx.conf

+34-9
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,37 @@ http {
2020
access_log /var/log/nginx/access.log main;
2121
sendfile on;
2222
keepalive_timeout 65;
23+
24+
upstream frontend {
25+
server frontend:3000;
26+
}
27+
28+
upstream api {
29+
server api:3001;
30+
}
31+
32+
upstream http-cache {
33+
server http-cache:8080;
34+
}
35+
36+
upstream print {
37+
server print:3003;
38+
}
39+
40+
upstream mail {
41+
server mail:1080;
42+
}
43+
44+
upstream pgadmin {
45+
server pg-admin:80;
46+
}
47+
2348
server {
2449
listen 3000;
2550
server_name localhost;
2651

2752
location / {
28-
proxy_pass http://frontend:3000;
53+
proxy_pass http://frontend;
2954
proxy_set_header Upgrade $http_upgrade;
3055
proxy_set_header Connection $connection_upgrade;
3156
}
@@ -37,27 +62,27 @@ http {
3762
proxy_buffers 4 256k;
3863
proxy_busy_buffers_size 256k;
3964
proxy_set_header X-Forwarded-Prefix /api;
40-
proxy_pass http://api:3001/;
65+
proxy_pass http://api/;
4166
proxy_set_header Upgrade $http_upgrade;
4267
proxy_set_header Connection $connection_upgrade;
4368
}
4469

4570
location /print {
46-
proxy_pass http://print:3003;
71+
proxy_pass http://print;
4772
proxy_set_header Upgrade $http_upgrade;
4873
proxy_set_header Connection $connection_upgrade;
4974
}
5075

5176
location /mail {
52-
proxy_pass http://mail:1080;
77+
proxy_pass http://mail;
5378
proxy_set_header Upgrade $http_upgrade;
5479
proxy_set_header Connection $connection_upgrade;
5580
}
5681

5782
location /pgadmin/ {
5883
proxy_set_header X-Script-Name /pgadmin;
5984
proxy_set_header Host $host;
60-
proxy_pass http://pg-admin:80/;
85+
proxy_pass http://pg-admin/;
6186
proxy_redirect off;
6287
}
6388
}
@@ -66,7 +91,7 @@ http {
6691
server_name localhost;
6792

6893
location / {
69-
proxy_pass http://frontend:3000;
94+
proxy_pass http://frontend;
7095
proxy_set_header Upgrade $http_upgrade;
7196
proxy_set_header Connection $connection_upgrade;
7297
}
@@ -78,19 +103,19 @@ http {
78103
proxy_buffers 4 256k;
79104
proxy_busy_buffers_size 256k;
80105
proxy_set_header X-Forwarded-Prefix /api;
81-
proxy_pass http://http-cache:8080/;
106+
proxy_pass http://http-cache/;
82107
proxy_set_header Upgrade $http_upgrade;
83108
proxy_set_header Connection $connection_upgrade;
84109
}
85110

86111
location /print {
87-
proxy_pass http://print:3003;
112+
proxy_pass http://print;
88113
proxy_set_header Upgrade $http_upgrade;
89114
proxy_set_header Connection $connection_upgrade;
90115
}
91116

92117
location /mail {
93-
proxy_pass http://mail:1080;
118+
proxy_pass http://mail;
94119
proxy_set_header Upgrade $http_upgrade;
95120
proxy_set_header Connection $connection_upgrade;
96121
}

0 commit comments

Comments
 (0)