Web Interface Via Nginx Proxy: Difference between revisions

From Proxmox VE
Jump to navigation Jump to search
(Add in Category:HOWTO)
(add headings and rework a bit for jessie/stretch)
Line 1: Line 1:
= Introduction =
This allows you to access Proxmox VE via the port 443
This allows you to access Proxmox VE via the port 443


Line 5: Line 6:
'''Why do I need this?'''
'''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...
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 begin...


= Configuration =
* '''nstall nginx'''
<pre>apt install nginx</pre>


'''install nginx'''
* '''remove the default config file (not needed on stretch & jessie?)'''
<pre>apt-get install nginx</pre>
<pre>rm /etc/nginx/conf.d/default</pre>


'''remove the default config file'''
* '''create a new config file'''
<pre>rm /etc/nginx/conf.d/default</pre>
<pre>nano /etc/nginx/conf.d/proxmox.conf</pre>


'''create a new config file'''
'''Note:''' on modern Debian systems the configuration files must have a ''.conf'' ending when placed in /etc/nginx/conf.d/  
<pre>nano /etc/nginx/conf.d/proxmox</pre>


The following is an example config that works for the webinterface and noVNC:
The following is an example config that works for the web interface and also the noVNC console:


<pre>
<pre>
Line 51: Line 54:
</pre>
</pre>


'''Reload and restart nginx'''
* '''Test and Apply new config'''
<pre>/etc/init.d/nginx reload; /etc/init.d/nginx restart</pre>
 
<pre>
# nginx -t  # checks config syntax
# systemctl restart nginx
</pre>


Enjoy the webinterface on HTTPS port 443!
Enjoy the webinterface on HTTPS port 443!

Revision as of 05:17, 31 May 2017

Introduction

This allows you to access Proxmox VE via the port 443

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 begin...

Configuration

  • nstall nginx
apt install nginx
  • remove the default config file (not needed on stretch & jessie?)
rm /etc/nginx/conf.d/default
  • create a new config file
nano /etc/nginx/conf.d/proxmox.conf

Note: on modern Debian systems the configuration files must have a .conf ending when placed in /etc/nginx/conf.d/

The following is an example config that works for the web interface and also the noVNC console:

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;
    }
}
  • Test and Apply new config
# nginx -t  # checks config syntax
# systemctl restart nginx

Enjoy the webinterface on HTTPS port 443!