The main goal of the Tomcat server is to provide a good web environment to run Java applications in comparison to other web servers. This article will walk you through the installation and configuration of Tomcat 8 on a server running Ubuntu 16.04. A server running Ubuntu 16.04. A non-root user with sudo privileges configured. Apache Tomcat. Apache Tomcat is a web container that allows you to serve Java Servlets and JSP (Java Server Pages) web applications. Ubuntu has supported packages for both Tomcat 6 and 7. Tomcat 6 is the legacy version, and Tomcat 7 is the current version where new features are implemented. Both are considered stable.
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!
7 Answers
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 -
restart Tomcat -
urls to access managers -
- tomcat test page - http://localhost:8080/
- manager webapp - http://localhost:8080/manager/html
- host-manager webapp - http://localhost:8080/host-manager/html
just wanted to put the latest info out there.
To access 'Host Manager' you have to configure 'admin-gui' user inside the tomcat-users.xml
Just add the below lines[change username & pwd] :
Restart tomcat 7 server and you are done.
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:
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 theName
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.- Tomcat 8
Copy XML
: Copy an application'sMETA-INF/context.xml
to the App Base/XML Base on deployment, and use that exclusively, regardless of whether the application is updated. Irrelevant ifDeploy XML
is false. Manager App
: Add the manager application to the Virtual Host (Useful for controlling the applications you might have underneathren.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.
I'm not sure about Tomcat 7, but with Tomcat 6... once you start Tomcat:By going into the bin directory and starting startup.bat
(win) or startup.sh
(Unix/osx) it will spin up a local instance of the server running usually on port 8080 by default. Then by going to http://localhost:8080/ and seeing that it is running, there is a link to the manager. If that page is not there, you can try loading the manager by going directly to manager/html, and that will load the Host Manager gui.
Make sure Tomcat is running first and that 8080 is the right port. These are just the defaults that tomcat usually runs with.
To login you need to edit the conf/tomcat-users.xml, and create a Manager GUI role
and add that to a user
Then when you go to Manager GUI app at http://localhost:8080/manager/html it will prompt you for a username/password, which you added to that config file.
Just a note that all the above may not work for you with tomcat7 unless you've also done this:
Tomcat 8:
The following worked for me with tomcat 8.
Add these lines to apache-tomcat-8.0.9/conf/tomcat-users.xml
For Manager:
For Host Manager:
Well if you are using Netbeans in Linux, then you should look for the tomcat-user.xml in
/home/Username/.netbeans/8.0/apache-tomcat-8.0.3.0_base/conf (its called Catalina Base and is often hidden)
instead of the apacahe installation directory.
open tomcat-user.xml inside that folder, uncomment the user and roles and add/replace the following line.
restart the server . That's all