Skip to content
Snippets Groups Projects
Commit 83eec146 authored by Lukáš Kratochvíl's avatar Lukáš Kratochvíl
Browse files

feat: added Nginx

parent 14db74f3
No related branches found
No related tags found
No related merge requests found
......@@ -9,5 +9,8 @@ DB_NAME=film-db
# ADMINER
ADMINER_PORT=8080
# NGINX
NGINX_PORT=3050
# CLIENT
CLIENT_PORT=3000
......@@ -50,6 +50,24 @@ services:
depends_on:
- postgres
nginx:
container_name: nginx
image: nginx:1.21.6-alpine
ports:
- 127.0.0.1:${NGINX_PORT}:${NGINX_PORT}
volumes:
- ./nginx/templates:/etc/nginx/templates
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
networks:
- backend-network
environment:
- NGINX_PORT=${NGINX_PORT}
- SERVER_PORT=${SERVER_PORT}
restart: always
depends_on:
- server
- postgres
client:
container_name: client
image: client:1.0.0
......
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
# TODO: logging does not work
access_log /var/log/nginx/access.log;
sendfile on;
keepalive_timeout 65;
# template files in /etc/nginx/templates/*.template are outputed as a result of executing envsubst to the /etc/nginx/conf.d folder
include /etc/nginx/conf.d/*.conf;
}
upstream nest_server {
# TODO: must be same port as the nestJS server container port
server server:3000;
}
server {
# IPv4
listen ${NGINX_PORT} default_server;
# IPv6
listen [::]:${NGINX_PORT} default_server;
location / {
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
#proxy_buffering off;
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-Proto $scheme;
proxy_pass http://nest_server;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment