How can we help you today?

Hypernode Managed Vhosts

Created by: Rens Zuurbier

Modified on: Thu, 11 Feb, 2021 at 2:19 PM

The Hypernode Managed Vhosts (HMV) system is an easy to use, yet powerful, system of configuring NginX on Hypernode. A vhost is a configuration that allows you to setup multiple domainnames, each with it's own, independent, configuration. With it, you can easily host a Wordpress blog on a subdomain, and a Magento on your main domain, set up https for both automatically, and efficiently redirect visitors to your www-domain.

The main advantage of HMV is that it separates your NginX config into a global folder, containing configuration for all server blocks, and domain specific configs, giving you more control and reducing unexpected side-effects of domain specific configurations.


Enabling Managed Vhosts

The Hypernode Managed Vhosts (HMV) system is currently enabled by default on all new booted Hypernodes. 

However if you have a Hypernode created before 01-05-2020 your Hypernode may still be running in 'legacy' mode. To enable the HMV you can run the command:

hypernode-systemctl settings managed_vhosts_enabled True

This will convert your current legacy config into the HMV config. It will also convert all currently active vhosts into managed vhosts.

Managing Vhosts

Once the Hypernode Managed Vhosts (HMV) system is enabled, you can start defining and configuring your vhosts. On new booted Hypernodes there will be one vhosts by default: 

Adding Vhosts

To add a new vhost, for example the domainname, to your configuration, you can simply run the command hypernode-manage-vhosts This will create a new vhost configuration in /data/web/nginx/, using the Magento 2 template. You can define the configuration template to use, by using the --type argument. For example, you can use the Magento 1 config by using the command hypernode-manage-vhosts --type magento1 You can choose from 'magento1', 'magento2', 'akeneo', 'vuestorefront', and more. For a complete list of available templates you can run the command hypernode-manage-vhosts --help.

Important: Simply creating the folder does NOT create a vhost. You will need to use the hypernode-manage-vhosts command

Please note that defining the vhosts '', does not automatically add '' as a vhost. You will have to manually define a vhost for this. Since most people simply want their '' to redirect to '', you can simply use the --type wwwizer argument to set this up. This will configure the vhost to redirect all traffic to the www-version of the domain.

Removing Vhosts

To remove an existing vhost, for example the domainname, from your configuration, you can simply run the command hypernode-manage-vhosts --delete This will remove the vhost configuration, and remove /data/web/nginx/

Please note that simply deleting the /data/web/nginx/ folder will NOT remove the vhost, but merely leave it in an unconfigured state.

Changing Vhosts

Once a vhost is configured, you cannot change the template used to create it. This is because the files from the templates are placed as a user-editable files, and changes may have been made to these. It is, however, possible to manually change the configuration. Alternatively, you can remove and recreate the vhost with the correct type. Please do note that this will remove all the existing configuration made for this specific domain name.

Listing Vhosts

To list all configured vhosts you can run the command: 

hypernode-manage-vhosts --list

This will provide a nice overview of all the vhosts with useful information like is it the default_server, is Let's Encrypt configured, or is Varnish enabled.

Let’s Encrypt and Hypernode Managed Vhosts

Please note: If you want to use Let’s Encrypt and have the Hypernode Managed Vhosts (HMV) system enabled, you need to configure LE during the creation of the vhost. Using the old method with dehydrated won't work!

First, check if HMV is enabled on your Hypernode:

hypernode-systemctl settings managed_vhosts_enabled

If so, it will give the following output:

managed_vhosts_enabled is set to value True

If you want to request a LE certificate you need to add the  --https flag with the HMV-command.

hypernode-manage-vhosts --https --force-https

This command will not only request a LE Certificate but because of the --force-https flag it will also redirects all traffic for that specific vhost to HTTPS.

Varnish and Hypernode Managed Vhosts

Using Varnish in combination with Varnish works slightly different with HMV enabled. Of course Varnish needs to be enables with the systemctl tool. hypernode-systemctl settings varnish_enabled True

But with HMV you need to configure the vhost for Varnish as well. You can do this by adding the --force-https flag to you HMV-command. For example: hypernode-manage-vhosts --varnish

Once you the command is processed you could list all the vhost to check if Varnish is enabled for that Vhost. The value in the Varnish column should be set to True.

Managing Configuration Files

Vhost-specific configuration

Once you have setup a vhost, say, you can place your domain specific configuration in its configuration folder, /data/web/nginx/ You can do this the same way you configured your legacy, or global configuration. Simply place a file with a server. prefix, and it will be included in the vhost's server {} configuration block. You can also still use the public. and staging. prefixes, if you wish to have public, or staging, specific configuration.
Please note that any files with the 'http.' prefix will also be loaded in the http context. NginX, however, only has a single http context. As such, any http configuration placed in a vhost, will also be loaded for all other vhosts.

Global configuration

Even when using the Hypernode Managed Vhosts (HMV) system, it's still possible to setup configuration on the 'global' level by placing a file in /data/web/nginx.

Multi-domain configuration

If you have multiple vhosts, and want to share configuration between them, without placing this in the global context, you can do so using symlinks. Simply remove a domain specific folder and replace it with a symlink to another domain's folder.


If you are running into issues (e.g. SSL or other configuration errors) with Hypernode Managed Vhosts, we recommend running this command first:

hypernode-manage-vhosts --all

This regenerates the HMV configuration based on what is set in hypernode-manage-vhosts --list and in our experience resolves most basic issues with Hypernode Managed Vhosts.

Rens is the author of this solution article.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.