Add Docker and Nginx config for frontend, backend, and MongoDB

This commit is contained in:
Francesco Lorenzo D'Amico
2026-03-19 11:27:14 +01:00
parent c983b6c42f
commit d525e8476d
6 changed files with 142 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
server {
listen 80;
# Serve the static React build
location / {
root /usr/share/nginx/html;
index index.html;
# Fallback to index.html for client-side routing
try_files $uri $uri/ /index.html;
}
# Proxy REST API requests to the backend
location /rooms {
proxy_pass http://backend:4000;
proxy_http_version 1.1;
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 the health check endpoint to the backend
location /health {
proxy_pass http://backend:4000;
proxy_http_version 1.1;
}
# Proxy Socket.IO — requires WebSocket upgrade headers
location /socket.io/ {
proxy_pass http://backend:4000;
proxy_http_version 1.1;
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_cache_bypass $http_upgrade;
}
}