tomcat Adding a Virtual Host to server.xml


Example

Once a virtual host has been added via the web application, directories will exist at:

{CATALINA_HOME}\conf\Catalina\{Name}
{CATALINA_HOME}\{App Base}

To persist the virtual host after a restart, the server.xml file must be updated with the configuration. A Host element needs to be added inside the Engine element, similar to this:

<Engine name="Catalina" ...>
  ...
  <Host name="my-virtual-app" appBase="virtualApp" autoDeploy="true" unpackWARs="true" ... />
</Engine>

The attributes in the Host element should reflect the selections made in the host manager GUI (see the Host documentation for details), but can be changed. Note that the Manager App option in the GUI does not correspond to any Host attribute.