Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagetext
server {
    listen 443 ssl;
    server_name console.your-site.com;
    charset utf-8;
    include /etc/nginx/ssl.conf;

    proxy_redirect off;
    resolver 8.8.8.8 1.1.1.1;

    set $proxmox_host 'https://proxmox.host:8006';

    # resources used by novnc/xtermjs app
    location ~ ^/(xtermjs|novnc)/ {
        proxy_pass $proxmox_host$request_uri;
    }

    # API methods needed to initialize console websocket
    location ~ /(termproxy|vncproxy|status/current)$ {
        proxy_pass $proxmox_host$request_uri;
    }
    
    location ~ /vncwebsocket$ {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";

        proxy_pass $proxmox_host$request_uri;
        proxy_ssl_server_name on;
        proxy_buffering off;

        client_max_body_size 0;
        proxy_connect_timeout  3600s;
        proxy_read_timeout  3600s;
        proxy_send_timeout  3600s;
        send_timeout  3600s;
    }
    
    location / {
        if ($args !~* "^console=|&console=") {
            return 401;
        }

        if ($args !~* "^xtermjs=1|&novnc=1") {
            return 404;
        }

        proxy_http_version 1.1;
        proxy_pass $proxmox_host;
    }
}

...