## Host Manager App -- HTML Interface

### Table of Contents

- Introduction
- Configuring Manager Application Access
- Interface Description
- Message
- Host Manager
- Host Name
- Add Virtual Host
- Persist Configuration
- Server Information

### Introduction

The Tomcat Host Manager application enables you to create, delete, and otherwise manage virtual hosts within Tomcat. This how-to guide is best accompanied by the following pieces of documentation:

- Virtual Hosting How-To for more information about virtual hosting.
- The Host Container for more information about the underlying xml configuration of virtual hosts and description of attributes.
- Host Manager App -- Text Interface for full description of the commands.

The Tomcat Host Manager application is a part of Tomcat installation, by default available using the following context: `/host-manager`. You can use the host manager in the following ways:

- Utilizing the graphical user interface, accessible at: `{server}:{port}/host-manager/html`.
- Utilizing a set of minimal HTTP requests suitable for scripting. You can access this mode at: `{server}:{port}/host-manager/text`.

Both ways enable you to add, remove, start, and stop virtual hosts. Changes may be presisted by using the `persist` command. This document focuses on the HTML interface. For further information about the graphical interface, see Host Manager App -- Text Interface.

### Configuring Manager Application Access

The description below uses `$CATALINA_HOME` to refer the base Tomcat directory. It is the directory in which you installed Tomcat, for example `C:\tomcat9`, or `/usr/share/tomcat9`.

The Host Manager application requires a user with one of the following roles:

- `admin-gui` - use this role for the graphical web interface.
- `admin-script` - use this role for the scripting web interface.

To enable access to the HTML interface of the Host Manager application, either grant your Tomcat user the appropriate role, or create a new one with the correct role. For example, open `${CATALINA_BASE}/conf/tomcat-users.xml` and enter the following:

    <user username="test" password="chang3m3N#w" roles="admin-gui"/>

No further settings is needed. When you now access `{server}:{port}/host-manager/html`,you are able to log in with the created credentials.

Note that in case you retrieve your users using the `DataSourceRealm`, `JDBCRealm`, or `JNDIRealm` mechanism, add the appropriate role in the database or the directory server respectively.

### Interface Description

The interface is divided into six sections:

- Message - Displays success and failure messages.
- Host Manager - Provides basic Host Manager operations , like list and help.
- Host name - Provides a list of virtual Host Names and enables you to operate them.
- Add Virtual Host - Enables you to add a new Virtual Host.
- Persist configuration - Enables you to persist your current Virtual Hosts.
- Server Information - Information about the Tomcat server.

### Message

Displays information about the success or failure of the last Host Manager command you performed:

- Success: OK is displayed and may be followed by a success message.
- Failure: FAIL is displayed followed by an error message.

Note that the console of your Tomcat server may reveal more information about each command.

### Host Manager

The Host Manager section enables you to:

- List Virtual Hosts - Refresh a list of currently-configured virtual hosts.
- HTML Host Manager Help - A documentation link.
- Host Manager Help - A documentation link.
- Server Status - A link to the Manager application. Note that you user must have sufficient permissions to access the application.

### Host Name

The Host name section contains a list of currently-configured virtual host names. It enables you to:

- View the host names
- View the host name aliases
- Perform basic commands, that is start, stop, and remove.

### Add Virtual Host

The Add Virtual Host section enables you to add a virtual host using a graphical interface. For a description of each property, see the Host Manager App -- Text Interface documentation. Note that any configuration added via this interface is non-persistent.

### Persist Configuration

The Persist Configuration section enables you to persist your current configuration into the server.xml file.

This functionality is disabled by default. To enable this option, you must configure the `StoreConfigLifecycleListener` listener first. To do so, add the following listener to your server.xml:

    <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>

After you configure the listener, click All to make your configuration persistent.

### Server Information

Provides a basic information about the currently-running Tomcat instance, the JVM, and the underlying operating system.