Skip to content

Commit

Permalink
Nginx with WSS
Browse files Browse the repository at this point in the history
  • Loading branch information
Rmarieta committed Jan 8, 2024
1 parent 558febb commit f3a3ed8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
25 changes: 12 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,21 @@ services:
condition: service_healthy
db:
condition: service_healthy

volumes:
- ./flask:/app

# nginx:
# image: nginx:latest
# container_name: nginx
# ports:
# - "80:80"
# - "443:443"
# volumes:
# - ./nginx/conf.d:/etc/nginx/conf.d
# - ./nginx/nginx.conf:/etc/nginx/nginx.conf
# - ./nginx/ssl-certs:/etc/nginx/ssl-certs
# depends_on:
# - flask
nginx:
image: nginx:latest
container_name: nginx
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/ssl-certs:/etc/nginx/ssl-certs
depends_on:
- flask

# to persist container volumes
volumes:
Expand Down
8 changes: 8 additions & 0 deletions nginx/conf.d/server.conf
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,12 @@ server {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Prefix /;
}

location /socket.io {
proxy_pass http://flask:5000/socket.io;
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
}
}
2 changes: 1 addition & 1 deletion nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# to avoid being a root user in the container
user nginx;
worker_processes 1;
worker_processes auto;

events {
# number of simultaneous connections allowed
Expand Down

0 comments on commit f3a3ed8

Please sign in to comment.