[[tigase41virtualHosts]]
= Virtual Hosts in Tigase Server
:author: Artur Hefczyc <artur.hefczyc@tigase.net>
:version: v2.0 August 2017. Reformatted for v8.0.0.

Tigase server supports multiple virtual hosts in a single server installation. Virtual hosts can be added or removed, enabled or disabled during runtime without restarting the service or disrupting normal operation.

This document describes how virtual hosts work in Tigase server and how to get the most out of this feature in your installation.

The xref:virtHosts['default-virtual-host'] property allows to define name of the single vhost domain which will be considered a default vhost domain for this installation. It allows you just to configure the domain name. Any additional configuration needs to be configured using ad-hoc commands.

Virtual hosts should be managed using ad-hoc commands or admin ui, visit xref:addManageDomain[Add and Manage Domains] for description of vhosts management process or visit xref:ad-hocCommands[Specification for ad-hoc Commands Used to Manage Virtual Domains] for more information about ad-hoc commands.

If you have components that may not be able to handle multiple vhosts or cluster mode, we have developed a virtual component solution as well, details in the xref:virtualComponents[Virtual Components for the Tigase Cluster] section.

You may also want to reference the Vhosts API for additional information:
- xref:addManageDomain[API Description for Virtual Domains Management in Tigase Server].

TIP: If you have a Tigase XMPP Server running in the cluster mode hidden behind some load balancer, or if internal IP or hostname of cluster nodes differ from the DNS name under which it is available from the internet, we would suggest setting a property `installation-dns-address` of `vhost-man` component to the DNS name which allows you to connect to all cluster nodes (ie. to the DNS name of the load balancer).
This will allow Tigase XMPP Server to do proper DNS lookups to verify that DNS domain name of the virtual host which you will try to add or update points to your XMPP installation.

[[defaultVhostConfiguration]]
== Default VHost configuration

It's possible to specify default configuration for all Virtual Host in TDSL configuration file (i.e. `etc/config.tdsl`) for selected parameters. To do so you should specify each configuration option within `defaults` bean belonging to `vhost-man` bean:

```
'vhost-man' () {
    'defaults' () {
        'domain-filter-policy' = null
        'hardened-mode' = false
        's2s-secret' = null
        trusted = null
        'vhost-disable-dns-check' = false
        'vhost-max-users' = 0L
        'vhost-message-forward-jid' = null
        'vhost-presence-forward-jid' = null
        'vhost-register-enabled' = true
        'vhost-tls-required' = false
    }
}
```