diff --git a/docker-compose.yml b/docker-compose.yml index dda949f..a019d4a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,17 @@ version: "3.2" services: + nginx: + image: nginx:1.19 + volumes: + - ./nginx/nginx.conf:/etc/nginx/conf.d/default.conf + ports: + - "127.0.0.1:8080:80" + environment: + - NGINX_PORT=80 + depends_on: + - collector + - redis + api: build: dockerfile: "./docker/Dockerfile.dev" diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..2cd4b8b --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,19 @@ +server { + listen 80 default; + + location / { + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://collector:3000; + } + + location /ws { + proxy_pass http://collector:3000; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # WebSocket support (nginx 1.4) + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + } +} \ No newline at end of file