tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lisa D Beggs/AC/VCU <ldbe...@vcu.edu>
Subject Re: Trouble setting up virtual host
Date Tue, 28 Jul 2009 14:43:48 GMT
From:
Mark Eggers <its_toasted@yahoo.com>
To:
Tomcat Users List <users@tomcat.apache.org>
Date:
07/27/2009 10:55 PM
Subject:
Re: Trouble setting up virtual host




As usual, late to the thread.

I'll use C) then:

> > C) on another workstation :
> > 
> >     - close the browser and re-open it.
> >     - in the browser, find the place where you can "clear the cache".
> >     - do it (clear the cache)
> >     - request the URL :
> >               
>   http://adm138/InfoViewApp
> > 
> >     - indicate the result here :
> > 
> > 
> > A:  Internet Explorer cannot display the webpage

This usually means that the other workstation cannot translate between the 
name you gave the host on the other workstation (adm138) and the IP 
address of your server.

I also noticed that while you use the fully qualified name in the other 
example (www.fmdreports.vcu.edu) you use the short name in your tests 
(adm138).

There are several things to try here, to see where the breakdown is.  I'll 
use numbers since everyone else is using letters.

1. From another workstation, open a DOS window (if it's Windows) or a UNIX 
shell command (if it's UNIX), and type the following:

ping adm138

1a) If you get:
Ping could not find the host adm138, then the other workstation does not 
know how to translate between the name and the IP address.

1b) If you get:
Four lines with a bunch of numbers, then the other workstation knows how 
to translate between the name and the IP address


**A:  Yes I get the replys back, it is able to ping ADM138


2. From another workstation, open a DOS window (if it's Windows) or a UNIX 
shell command (if it's UNIX) and type the following:

ping adm138.fmdreports.vcu.edu

2a) If you get:
Ping could not find the host adm138.fmdreports.vcu.edu, then the other 
workstation does not know how to translate between the name and the IP 
address.


**A:  I can not ping adm138.fmdreports.vcuedu - HOWEVER, I can ping 
fmdreports.vcu.edu (and this is how we want the user to be name to be 
setup so that is setup correctly)

2b) If you get:
Four lines with a bunch of numbers, then the other workstation knows how 
to translate between the name and the IP address

adm138.fmdreports.vcu.edu may be the fully qualified name, but this 
depends on how your network administrator has set up something called DNS.

Firewall check
==============

Windows comes with a built-in firewall.  On XP/Professional it's located 
in Start->Control Panel->Network Connections.  You'll have to single-click 
on the active network (the one your server connects to) to see Change 
Firewall Settings on the left hand side.

Once you click on that (Change Firewall Settings), you should be able to 
edit the settings by selecting Exceptions tab.  Hopefully you'll see two 
entries for Java(TM) Platform SE Binary.  Make sure that the JRE you're 
using to run Tomcat is there (by clicking on edit and reading the 
properties).

Short term fix (once you've checked your firewall)
==================================================

If you have administrative privileges on the other workstation (Windows) 
or root access (UNIX), you can add some information in a file called 
hosts.  On Windows, it's located in the %windir%\System 32\drivers\etc 
directory.  In UNIX it's located in /etc

The line you need to add is the following:

aaa.bbb.ccc.ddd adm138

where aaa.bbb.ccc.ddd is the IP address of the machine with your Tomcat 
server.

If the fully qualified name is supposed to be adm138.fmdreports.vcu.edu, 
then add this line instead to the hosts file

aaa.bbb.ccc.ddd adm138 adm138.fmdreports.vcu.edu

where aaa.bbb.ccc.ddd is the IP address of the machine with your Tomcat 
server.

Long term (proper) fixes
=========================

There are really two parts to this fix.  The first part is to get your 
network administrator to add this hostname and IP address to your campus 
DNS server.  The DNS server is responsible for translating between 
human-readable names and IP addresses.  Once the name you have chosen for 
your server is in DNS, all machines using DNS servers will know how to 
interpret the name of the host.

**A:  They have done this www.fmdreports.vcu.edu is replacing the lengthy 
URL name of the web browser application(Infoview) that our users are using 
to use when viewing/scheduling Crystal Reports.  This is a Crystal Reports 
Server running Tomcat (not sure if you saw the initial post.

The second part of the fix is to alter your virtual host definition in 
server.xml.  In general, it's a good idea to only use fully qualified 
names in the server.xml file.

So, in part, your host element should look like this:

<Host name="fully-qualified-host-name" . . . . >

</Host>

For example:

<Host name="adm138.fmdreports.vcu.edu" . . . >

</Host>

However, if you want to have this virtual host respond to other names, you 
can add aliases for each name.  To do that, just add an alias element for 
each name you want.

<Host name="fully-qualified-host-name" . . . .>
  <Alias>some-other-name</Alias>
  <Alias>still-another-name</Alias>

</Host>

For example:

<Host name="production.fmdreports.vcu.edu" . . . >
  <Alias>adm138.fmdreports.vcu.edu</Alias>
  <Alias>another.fmdreports.vcu.edu</Alias>

</Host>

If you want those aliases to be visible to other select workstations, then 
you will have to edit the hosts file for each workstation like I've shown 
above.  Obviously, this is not a permanent fix if you have to edit 1000s 
of hosts on campus.

If you want to have those alias names reachable from workstations that are 
not your server, then tell your network administrator what those names 
should be.  Please remember if these names are going to be globally 
visible, you will have to use fully qualified names, not something like 
adm138.

**A:  I have done this already on the server.xml file......but I need it 
to point to my application which is located in the webapps/Infoview folder 
(to bring up the logon.jsp page)  Not sure if what I have is correct 
because it does not work of course and that is when I joined the forum for 
help.

<Host name="www.fmdreports.vcu.edu" appBase="webappps/InfoViewApp" 
unpackWARs="false" autoDeploy="true" xmlValidation="false" 
xmlNamespaceAware="false">
        <Alias>fmdreports.vcu.edu</Alias>
      </Host>
 

Host Name Resolution Background
===============================

Finally, there's a bit of magic happening on your workstation depending on 
how it's configured.  As I've said above, all host names should be fully 
qualified.  If that's the case, then how does mapping adm138 to an IP 
address work?

The code that maps a name to an IP address queries its own host name, the 
hosts file, and configured network servers.  This is configurable with 
UNIX, but not (if I remember correctly) under Windows.

When asking a server, the code that requests the information can add a 
domain name suffix (in your case it might be fmdreports.vcu.edu or 
vcu.edu).  That means for the first request to any network server, your 
workstation will tack on that information to the end of the name you give 
it.

In other words adm138 becomes adm138.fmdreports.vcu.edu before it gets 
sent to the server as a question.  There are rules about truncating the 
suffix (fmdreports.vcu.edu, then vcu.edu).

So depending on your workstation's configuration, the search code would do 
this on getting adm138:

1. Is it my hostname?
   Yes - great, we're done

2. Is it in my hosts file
   Yes - great, we're done

3. Add my Primary (or default) domain (may be fmdreports.vcu.edu)

4. Ask the server for adm138.fmdreports.vcu.edu
   Yes - great, we're done

5. Ask the server for adm138.vcu.edu
   Yes - great, we're done

If all responses were "not found" (NXDOMAIN), then you get a page not 
found error in IE.

Summary
=======

1. Put fully qualified host names the <Host></Host> element in server.xml.
2. Put in any aliases (qualified or not) in the <Alias></Alias> element 
   of server.xml
3. Get your network administrator to add all fully qualified names to DNS
4. Put all unqualified names in hosts files of hosts that you want to 
   connect to your server
5. Remember that the use of hosts files is purely for testing.  DNS 
   should be used for all production work

Hopefully that will get you up and running.  If not, then your network 
administrator has blocked access to port 80 from other parts of the 
network.  This is reasonable for example, to prevent students from running 
their own web servers.  You'll have to ask your network administrator to 
grant access to port 80 (as a server) for your particular IP address.

I apologize for the length.  Hopefully that will complete your 
connectivity and get you up and running.

Mark


 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message