Question

Tomcat 6 virtual host name

Asked by: mbayader

Hi everyone,
I am working on an internal webapp using tomcat and mysql installed in a server.  What I am trying to do is to set up a virtual host with an appropriate name like for example
www. adminsys.com
So I went to the server.xml   file and added the following:
<!-- Setting up my virtual host -->
<Host name="127.0.0.1" debug="0" appBase="webapps/AdminSystem"
unpackWARs="true" autoDeploy="true">
<Alias>AdminSys</Alias>
<Context path="" docBase="" debug="0"/>
</Host>
But when write AdminSys in my iexplorer   address nothing comes up, even though its working fine  the normal way, which is http://localhost/AdminSys
Many thanks,

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2007-04-27 at 03:24:24ID22538008
Tags

tomcat

,

6

,

virtual

,

host

Topics

Apache Tomcat Application Server

,

Application Servers

,

Apache Web Server

Participating Experts
2
Points
500
Comments
10

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. apache + tomcat
    I am now config apache + tomcat I defined a virtual host that point to the tomcat examples This is what I added in httpd.conf LoadModule jk_module "c:/Abria Merlin/Apache/modules/mod_jk.dll" AddModule mod_jk.c JkWorkersFile "C:/jakarta-tomcat/conf/worke...
  2. JMeter and Tomcat's server.xml <Connector> attribute …
    Hi experts, Could anyone explain the meaning of the attributes of the <Connector> node in Tomcat 4.1.18LE's server.xml (or point me to reference material as the manual does not seem to explain this) ? I understand the className, port and redirect port but not the othe...
  3. Tomcat 4.0.x - Order of webapps initialization?!
    Hi all, Is there a way i can ask Tomcat to enforce an order of initialization for my webapps? It seems that the order of context declarations in the server.xml file does not make any difference. Thank you.
  4. Need to move webapps in Tomcat
    I am using a Windows 2003 server with IIS to host websites. Some of our sites are using Jakarta Tomcat integrated with IIS. We need to move the websites hosted by tomcat from the C: drive to the D:\wwwroot folder. I know I can easily change the path in IIS, but what compl...
  5. Declaring DataSource in server.xml?
    Hello, I read on the tomcat website, to change the server.xml file as: Configure the JNDI DataSource in Tomcat by adding a declaration for your resource to $CATALINA_HOME/conf/server.xml. Add this in between the </Context> tag of the examples context and the </Hos...
  6. Having nightmare configuring server.xml
    Hi, I have a server.xml file that I need to configure to get my jsp pages fetching data from mysql database. My Server is apache/tomcat 5.5.16 and MySQL version is 5.0. The connector .jar for MySQL is in place. Now I have to configure <Context> tag in server.xml for My...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: R7AFPosted on 2007-04-27 at 04:06:30ID: 18987844

The Alias is for domain names, like:
<Alias>admin.domain.com</Alias>

Another example:

<Host name="www.firstdomain.com" debug="1" appBase="firstdomain/webapps" unpackWARs="true">  
      <Logger className="org.apache.catalina.logger.FileLogger" directory="logs"
            prefix="projects." suffix=".txt" timestamp="true"/>  
      <Context path="" docBase="" debug="1" reloadable="true" crossContext="true" />  
      <Alias>firstdomain.com</Alias>
</Host>
<Host name="www.seconddomain.com" debug="1" appBase="seconddomain/webapps" unpackWARs="true">  
      <Logger className="org.apache.catalina.logger.FileLogger" directory="logs"
            prefix="projects." suffix=".txt" timestamp="true"/>  
      <Context path="" docBase="" debug="1" reloadable="true" crossContext="true" />  
      <Alias>seconddomain.com</Alias>
</Host>

In this example www.firstdomain.com and firstdomain.com point to appBase="firstdomain/webapps". See that I reversed webapps and firstdomain?

www.seconddomain.com and seconddomain.com point to appBase="seconddomain/webapps". Each host has a seperate webapp directory. Therefor I suggest using a file structure like:

* hosts
** firstdomain/webapps
** seconddomain/webapps
** etc/webapps

I've tried to leave out the webapps and put the wars/applications directly in the firstdomain directory, but for some reason that didn't work. That was on a Windows system though!

 

by: R7AFPosted on 2007-04-27 at 04:09:50ID: 18987853

The appBase should be more like: appBase="/www/hosts/firstdomain/webapps" in this example, if hosts resides in /www

 

by: mbayaderPosted on 2007-04-27 at 04:48:50ID: 18987999

many thanks for your comments , sorry but i couldn't relate to your example. Unfortunately I  don't have much experience with tomcat server configuration.

my web application is stored inside Tomcat's webapps folder.  its under a folder called AdminSys inside webapps. when i try to browser my web application using the tomcat manager page its working fine but as i explained i would like to create a virtual address for my web application.

So what is the equivalent in my application to appBase?? is it the link i find when i am browsing my webapplication using the tomcat management page or is it the physical address in the computer. or perhaps i am missing something??

Many thankx again,

 

by: R7AFPosted on 2007-04-27 at 07:22:17ID: 18989206

I'm not sure that everything is clear to me. Do you need to use several domain names with each a different environment? Or do you only use one domain name? If you use only one domain name for all applications (one or many), then you don't need to add a host. You can use the default one.

If not, please let me know.

Try the following:

<!-- Setting up my virtual host -->
<Host name="127.0.0.1" debug="0" appBase="webapps"
      unpackWARs="true" autoDeploy="true">
      <Context path="" docBase="" debug="0"/>
      <Alias>www.adminsys.com</Alias>
</Host>

The location of your webapps is:
$CATALINA_HOME/webapps/
"$CATALINA_HOME" is the installation directory of Tomcat.

If you put your "AdminSystem" webapp inside the webapps dir, the URL is:
http://www.adminsys.com/AdminSystem

Inside the ROOT directory, you can add an index file to redirect to your webapp.

 

by: R7AFPosted on 2007-04-27 at 07:31:39ID: 18989295

Btw, this is not a virtual host. This is just an alias! A virtual host is used when you only have one IP-address and different domain names. Each domain name should have its own webapp folder. You could of course let them share the same folder, using only <Alias>, but that would have many disadvantages.

Another thing... Is the domain name (www.adminsys.com) pointing to your machine, to the right IP-address? If not, and if this is just for testing purposes, you need to edit the host file of your computer, so it catches the domain name and directs it to 127.0.0.1. If you want to try a real world example, you can register with dyndns.org and try a dynamic or static subdomain that points to your machine.

 

by: mbayaderPosted on 2007-05-04 at 04:30:38ID: 19030046

Many thanks for your very informative answer, everything is working fine except for the  alias thing. I can’t use the alias name  to access the server from the other workstations in the local network:

 My server.xml <host> tag is as follows:
<Host name="MyNetworkDomainName” appBase="AdminSystem"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
 <Context path="" docBase="" debug="0"/>

<! -- This part of the file doesn’t work from other workstations in the network-->
 <Alias>www.adminsys.com</Alias>        
      </Host>

 

by: R7AFPosted on 2007-05-25 at 06:05:49ID: 19156474

Thanks for the points!

When a computer sends out a request for a website page, using a domain name, the first thing that happens is matching the domain name to an ip-address. This is done by a DNS server. This can be the DNS server of your provider, or if your on a local network it can be the router and even your local computer. The point is that somehow this link has to be made.

I don't know if adminsys.com is the actual name you are using or not. Suppose it is, then your computer, and your router will look it up in their local dns-database, and find nothing. Then they go to the dns-server of your provider. That will find nothing, after which it will send out a request to some higher dns-server, etc.

You can however filter domain names on your local network and route them to other ip-addresses. So you could route adminsys.com to 192.168.0.10, if that is your webserver. You can make such a link in your computer's host file. Then it will only work for that one computer. You can do this for each computer in the network. But that's not really easy to maintain. Thus it's better to do this on your router/firewall. Then all computers on the network that use the router's dns will end up at your webserver.

Another thing is that domain names that are routed to this machine and that don't have an alias, those domain names will be handled by the default host in your server.xml. So if you only have one host, then you don't need an alias. Aliases are only meant so Tomcat understands which domain name belongs to what host.

 

by: R7AFPosted on 2007-05-25 at 06:09:00ID: 19156500

I only wonder why you've given a B-grade for this question?

 

by: mbayaderPosted on 2007-05-30 at 02:15:15ID: 19178276

Don’t get me wrong your first answer was very good and it solved my main problem but I was a bit confused about the whole domain concept  but the added comment is what I was hoping for to give you the A grad.  Many thanks again you have been so helpful.

 

by: peter_thomasPosted on 2008-02-28 at 05:24:02ID: 21003393

the solution was fantastic. its the best example i have seen on the internet.

To mbayader: B grade because you dont understand the "whole domain concept".  ?????

Good job thanks very much R7AF.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...