File tree Expand file tree Collapse file tree 2 files changed +25
-17
lines changed Expand file tree Collapse file tree 2 files changed +25
-17
lines changed Original file line number Diff line number Diff line change 1
1
version : " 3.7"
2
2
3
3
services :
4
- api :
5
- container_name : " api "
4
+ docker-fastapi :
5
+ container_name : " docker-fastapi "
6
6
build :
7
7
context : .
8
8
dockerfile : ./docker/api/Dockerfile
@@ -12,11 +12,11 @@ services:
12
12
- 8080:8080
13
13
14
14
nginx :
15
- container_name : " nginx "
15
+ container_name : " proxy-app "
16
16
build :
17
17
context : .
18
18
dockerfile : ./docker/nginx/Dockerfile
19
19
ports :
20
20
- 80:80
21
21
depends_on :
22
- - api
22
+ - docker-fastapi
Original file line number Diff line number Diff line change
1
+ upstream docker_fastapi {
2
+ server docker-fastapi:8080 ;
3
+ }
4
+
1
5
server {
2
- listen 80 ;
6
+ listen 80 ;
3
7
4
- location / {
5
- root /usr/share/nginx/html;
6
- index index .html index .htm;
7
- try_files $uri $uri / /index .html;
8
- }
8
+ location ~ /api/ {
9
+ proxy_pass http ://docker_fastapi;
10
+ proxy_set_header Host $host ;
11
+ proxy_set_header X-Real-IP $remote_addr ;
12
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for ;
13
+ proxy_set_header X-Forwarded-Host $server_name ;
14
+ }
9
15
10
- location /api/v1/ {
11
- proxy_pass http ://api:8080 /;
12
- }
16
+ location / {
17
+ root /usr/share/nginx/html;
18
+ index index .html index .htm;
19
+ try_files $uri $uri / /index .html;
20
+ }
13
21
14
- error_page 500 502 503 504 /50x .html;
15
- location = /50x .html {
16
- root /usr/share/nginx/html;
17
- }
22
+ error_page 500 502 503 504 /50x .html;
18
23
24
+ location = /50x .html {
25
+ root /usr/share/nginx/html;
26
+ }
19
27
}
You can’t perform that action at this time.
0 commit comments