GitHub user daviftorres edited a comment on the discussion: Nginx or Apache as a reverse proxy in front of CloudStack (including VNC console support)
Here’s my NGINX setup (very similar to what @dR3b and @bhouse-nexthop shared). I’m assuming SSL (wildcard cert) is terminated on NGINX for all services: ``` ssl_certificate /etc/nginx/fullchain.crt; ssl_certificate_key /etc/nginx/privatekey.key; ssl_protocols TLSv1.2 TLSv1.3; ssl_prefer_server_ciphers on; ssl_ciphers <your_preferred_ciphers>; server { listen 80 default_server; listen [::]:80 default_server; server_name _; return 301 https://$host$request_uri; } ``` For small environments (around 10~30 concurrent SysVMs), you can create a host-to-IP mapping that includes the environment name (dev, test, stage, poc, hotfix, etc.) ``` map $host $backend_ip { 10-10-1-200.<environment>.example.com 10.10.1.200; 10-10-1-201.<environment>.example.com 10.10.1.201; 10-10-1-202.<environment>.example.com 10.10.1.202; # add more as needed } ``` This setup covers Console Proxy VMs and Secondary Storage VMs: ``` server { listen 443 ssl; server_name ~^(10-10-1-\d+\.<environment>\.example\.com)$; client_max_body_size 0; proxy_http_version 1.1; proxy_request_buffering off; location / { proxy_pass https://$backend_ip:443; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } ``` For WebSocket Secure (WSS) traffic: ``` server { listen 8443 ssl; server_name _; client_max_body_size 0; proxy_http_version 1.1; proxy_request_buffering off; location /websockify { proxy_pass https://$backend_ip:8443; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; proxy_set_header Host $host; proxy_read_timeout 600s; proxy_buffering off; } } ``` Both use the same host-to-IP mapping, without a tailored regex. For larger environments, consider HAProxy, Varnish, or Envoy because they scale better and handle complex routing more efficiently. Warning: Using a loose regex for server_name can expose other network assets (via fuzzing/guessing IPs). Keep the regex strict to SysVMs only. GitHub link: https://github.com/apache/cloudstack/discussions/11562#discussioncomment-14307891 ---- This is an automatically sent email for users@cloudstack.apache.org. To unsubscribe, please send an email to: users-unsubscr...@cloudstack.apache.org