Web Interface Via Nginx Proxy

From Proxmox VE
Revision as of 08:08, 4 August 2016 by Emmanuel Kasper (talk | contribs) (Created page with "= Web interface HTTPS(443) via nginx as proxy = ''Tested from Proxmox 3.4 - 4.2, still works fine!'' '''Why do I need this?''' Sometimes there is a firewall restriction tha...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Web interface HTTPS(443) via nginx as proxy

Tested from Proxmox 3.4 - 4.2, still works fine!

Why do I need this?

Sometimes there is a firewall restriction that blocks port 8006 and since we shouldn't touch the port config in proxmox we'll just use nginx as proxy to provide the web interface available on default https port 443. Now let's beginn...


install nginx

apt-get install nginx

remove the default config file

rm /etc/nginx/conf.d/default

create a new config file

nano /etc/nginx/conf.d/proxmox

The following is an example config that works for the webinterface and noVNC:

upstream proxmox {
    server "FQDN HOSTNAME";
}
 
server {
    listen 80 default_server;
    rewrite ^(.*) https://$host$1 permanent;
}
 
server {
    listen 443;
    server_name _;
    ssl on;
    ssl_certificate /etc/pve/local/pve-ssl.pem;
    ssl_certificate_key /etc/pve/local/pve-ssl.key;
    proxy_redirect off;
    location / {
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade"; 
        proxy_pass https://localhost:8006;
	proxy_buffering off;
	client_max_body_size 0;
	proxy_connect_timeout  3600s;
        proxy_read_timeout  3600s;
        proxy_send_timeout  3600s;
        send_timeout  3600s;
    }
}

Reload and restart nginx

/etc/init.d/nginx reload; /etc/init.d/nginx restart

Enjoy the webinterface on HTTPS port 443!