upstream nodeapp { ip_hash; server 127.0.0.1:8081; server 127.0.0.1:8082; server 127.0.0.1:8083; server 127.0.0.1:8084; server 127.0.0.1:8085; } server { listen 80; listen [::]:80; server_name _; return 301 https://$server_name$request_uri; } server { listen 443 ssl; listen [::]:443 ssl; server_name _; root /home/mab/pi/client/; access_log /var/log/nginx/httpslocalhost.access.log; error_log /var/log/nginx/httpslocalhost.error.log; include snippets/self-signed.conf; include snippets/ssl-params.conf; location / { proxy_pass http://localhost:8080; 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; } location /io { proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; proxy_http_version 1.1; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $host; proxy_pass http://nodeapp; } location /public { autoindex on; alias /home/mab/pi/client/public; access_log off; expires max; } }