docker: add nginx server

This commit is contained in:
Chika 2022-11-29 14:30:24 +03:00
parent b6d1608fe0
commit 52af419254
2 changed files with 49 additions and 0 deletions

View File

@ -11,6 +11,8 @@ services:
- APP_TITLE=${WEB_APP_TITLE}
- APP_DESCRIPTION=${WEB_APP_DESCRIPTION}
restart: always
networks:
- auth_network
api:
container_name: ${API_NAME}
build:
@ -37,6 +39,13 @@ services:
ALLOW_EMPTY_PASSWORD: 'yes'
networks:
- auth_network
server:
image: nginx
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf
restart: always
networks:
- auth_network
networks:
auth_network:

40
nginx.conf Normal file
View File

@ -0,0 +1,40 @@
worker_processes 4;
events {
worker_connections 1024;
}
http {
upstream web {
server web:3000;
}
upstream api {
server api:3001;
}
server {
listen 80;
include /etc/nginx/mime.types;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
location / {
proxy_pass http://web;
}
location /api/ {
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_pass http://api/;
}
}
}