Skip to content

Commit 920fc86

Browse files
Mikołaj KamińskiMikołaj Kamiński
authored andcommitted
Initial commit
0 parents  commit 920fc86

File tree

7 files changed

+68
-0
lines changed

7 files changed

+68
-0
lines changed

docker-compose.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
version: '3.9'
2+
3+
services:
4+
proxy:
5+
image: nginx:1-alpine
6+
volumes:
7+
- ./nginx_configs/:/etc/nginx/conf.d/:ro
8+
- ./proxy/:/usr/share/nginx/html/:ro
9+
ports:
10+
- "8080:80"
11+
networks:
12+
- internal-network
13+
service_a:
14+
image: nginx:1-alpine
15+
hostname: service_a
16+
volumes:
17+
- ./service_a/:/usr/share/nginx/html/:ro
18+
networks:
19+
- internal-network
20+
service_b:
21+
image: nginx:1-alpine
22+
hostname: service_b
23+
volumes:
24+
- ./service_b/:/usr/share/nginx/html/:ro
25+
networks:
26+
- internal-network
27+
28+
networks:
29+
internal-network:

nginx_configs/default.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
server {
2+
listen 80;
3+
4+
location / {
5+
root /usr/share/nginx/html;
6+
index index.html index.htm;
7+
}
8+
}

nginx_configs/service_a.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
upstream service_a {
2+
server service_a:80;
3+
}
4+
5+
server {
6+
listen 80;
7+
server_name service_a.example.com;
8+
9+
proxy_set_header Host $host;
10+
11+
location / {
12+
proxy_pass http://service_a;
13+
}
14+
}

nginx_configs/service_b.conf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
upstream service_b {
2+
server service_b:80;
3+
}
4+
5+
server {
6+
listen 80;
7+
server_name service_b.example.com;
8+
9+
proxy_set_header Host $host;
10+
11+
location / {
12+
proxy_pass http://service_b;
13+
}
14+
}

proxy/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is proxy service

service_a/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is Service A

service_b/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This is Service B

0 commit comments

Comments
 (0)