A subdomain per virtual machine


Nov 5, 2019
I would like to have a subdomain per virtual machine
Exemple : vm1.domain.com => port 80 , 22 , 9091...
vm2.domain.com => port 80 , 22 , 9091...



  • 1572912592315.png
    15.2 KB · Views: 74

Yes, you can have a FQHN (Fully-Qualified Host Name) for every VM.
  • Like
Reactions: Vishnu
In our case we use private IP addressed for VMs and only one public IP address. On the public IP address we run an Apache proxy and for each vm we create one or more vhost files. Also here we do SSL termination or Base auth password protection.

For the other ports we have port forwarding setup.

<VirtualHost *:80>
    ServerName vm3.example.com
    ServerAlias *.vm3.example.com
    ServerAlias *.*.vm3.example.com

    ServerAdmin webmaster@example.com
    LogLevel warn
    ErrorLog /var/log/apache2/vm3.example.com-error.log
    CustomLog /var/log/apache2/vm3.example.com-access.log "%a %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\""
    ProxyRequests Off
    ProxyPreserveHost On
    ProxyPass         / connectiontimeout=10 timeout=90
    ProxyPassReverse  /
Sorry, but what is the question?
I would like have one domain per virtual machine with all accessible ports
I have only 1 public IP but I would like to access all my vm from outside with sub domain by vm
You can do that for HTTP / HTTPS traffic (and maybe some other protocols too), but you can not do that for SSH for example.
You can have your VMs "natted" in a subnet on your host, proxy all incoming traffic on ports 80 (http) and 443 (https) to that VM which will then handle the HTTP(s) traffic and proxy to accordingly to the VMs.

I am not aware of any way to fully automate the vHost creation/deletition when a new VM is created / when it is deleted
I would like have one domain per virtual machine with all accessible ports

This will not be possible with only 1 routable IP address.. you cant redirect the same SOURCE IP/PORT to different "internal" servers at same time.. NAT does not support it, you can do some tricks with apache proxy but only for protocols http/https.
Fully-Qualified Host Name has nothing to do with internal/external IP/Port mapping.
This topic has nothing to do with Proxmox VE.
For SSH you can use SSLH Gateway.


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!