worker_processes 4;

events { worker_connections 1024; }

http {

	upstream node-app {
	      least_conn;
	      server node1:8080 weight=60 max_fails=10 fail_timeout=60s;
	      server node2:8080 weight=60 max_fails=10 fail_timeout=60s;
	      server node3:8080 weight=60 max_fails=10 fail_timeout=60s;
	}
	 
	server {
	      listen 80;
	 
	      location / {
	        proxy_pass http://node-app;
	        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;
	      }
	}
}
