tomcat Tomcat Virtual Hosts Adding a Virtual Host via the Tomcat Host Manager Web Application

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

Once you have access to the host-manager, the GUI will let you add a virtual host.

Note: In Tomcat 7 and 8, adding a virtual host via the GUI does not write the vhost to config files. You will need to manually edit the server.xml file to have the vhost available after a restart. See http://tomcat.apache.org/tomcat-7.0-doc/virtual-hosting-howto.html for further info on the <Host> tag in server.xml

Tomcat Host Manager - Add Virtual Host

At a minimum you need the Name and App Base fields defined. Tomcat will then create the following directories:

{CATALINA_HOME}\conf\Catalina\{Name}
{CATALINA_HOME}\{App Base}
  • App Base will be where web applications will be deployed to the virtual host. Can be relative or absolute.
  • Name is usually the fully-qualified domain name (e.g. ren.myserver.com)
  • Alias can be used to extend the Name also where two addresses should resolve to the same host (e.g. www.ren.myserver.com). Note that this needs to be reflected in DNS records.

The checkboxes are as follows:

  • Auto Deploy: Automatically redeploy applications placed into App Base. Dangerous for Production environments!
  • Deploy On Startup: Automatically boot up applications under App Base when Tomcat starts
  • Deploy XML: Determines whether to parse the application's /META-INF/context.xml
  • Unpack WARs: Unpack WAR files placed or uploaded to the App Base, as opposed to running them directly from the WAR.
  • Tomcat 8 Copy XML: Copy an application's META-INF/context.xml to the App Base/XML Base on deployment, and use that exclusively, regardless of whether the application is updated. Irrelevant if Deploy XML is false.
  • Manager App: Add the manager application to the Virtual Host (Useful for controlling the applications you might have underneath ren.myserver.com)

Adapted from my answer: http://stackoverflow.com/a/26248511/6340



Got any tomcat Question?