Hi I have Apache Tomcat 7.0.5 on my Windows server, and i see that it has a built in Host Manager, but i can't seem to find any useful info on how to use it or set up a virtual Host with that GUI.
The fields are Name: Aliases: App Base: AutoDeploy Deploy on Startupdeploy XML UnpackWARS ManageApp: any where I can get a tutorial on how to set it up, or info on this??
Thanks!
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 .
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.
Solution for a fresh install of Tomcat 7 on Ubuntu 12.04.
Edit this file - /etc/tomcat7/tomcat-users.xml
to add this xml section -
<tomcat-users> <role rolename="admin"/> <role rolename="admin-gui"/> <role rolename="manager-gui"/> <user username="tomcatadmin" password="tomcat2009" roles="admin,admin-gui,manager-gui"/> </tomcat-users>
restart Tomcat -
service tomcat7 restart
urls to access managers -
just wanted to put the latest info out there.
Host Manager is a web application inside of Tomcat that creates/removes Virtual Hosts within Tomcat.
A Virtual Host allows you to define multiple hostnames on a single server, so you can use the same server to handles requests to, for example, ren.myserver.com
and stimpy.myserver.com
.
Unfortunately documentation on the GUI side of the Host Manager doesn't appear to exist, but documentation on configuring the virtual hosts manually in context.xml
is here:
http://tomcat.apache.org/tomcat-7.0-doc/virtual-hosting-howto.html.
The full explanation of the Host
parameters you can find here:
http://tomcat.apache.org/tomcat-7.0-doc/config/host.html.
Adding a virtual host
Once you have access to the host-manager (see other answers on setting up the permissions, the GUI will let you add a (temporary - see edit at the end of this post) 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 startsDeploy 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.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
)Update: After playing around with this same process on Tomcat8, the behaviour I'm seeing is that adding a virtual host via the GUI isn't persistent - it doesn't get written to server.xml
, even on shutdown. Therefore (unless I'm doing something terribly wrong), you can create it in the GUI, but you'll need to edit server.xml
anyway, as per the first link above, to make it stick.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With