You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lisa D Beggs/AC/VCU <ld...@vcu.edu> on 2009/08/03 16:31:05 UTC

Re: Trouble setting up virtual host

I guess nobody is willing to help me any further on the below?
_____________________________________________









From:
Lisa D Beggs/AC/VCU <ld...@vcu.edu>
To:
"Tomcat Users List" <us...@tomcat.apache.org>
Date:
07/30/2009 12:47 PM
Subject:
Re: Trouble setting up virtual host



Thanks to all those that have helped with this issue.

I contacted our Networking department to make sure that both ports 80 and 
443 were open inbound to the server and that they were open from both VCU 
and external networks (outside VCU).  The issue was on their end and it 
has been resolved!

I am also able to connect to my application using the virtual host 
www.fmdreports.vcu.edu/InfoViewApp (which automatically loads the 
logon.jsp page).

However, what I would really like to have happen is to only have to type 
in www.fmdreports.vcu.edu or fmdreports.vcu.edu and not have to type the 
/InfoViewApp after it and have set it to load the login page which is 
www.fmdreports.vcu.edu/InfoViewApp/logon.jsp

Here is a copy of what I have in the host element......how can I 
accomplish the above?

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

_____________________________________________
"Change is the essence of life. Be willing to surrender what you are, for 
what you could become". 

Lisa D. Beggs 
Information Technology Specialist
Business Application Services
Phone:  804 828-2098
Fax:   804 828-0322

Don't be a phishing victim - VCU and other reputable organizations will 
never use email to request that you reply with your password, social 
security number or confidential personal information.  For more details 
visit http://infosecurity.vcu.edu/phishing.html 








From:
Mark Eggers <it...@yahoo.com>
To:
Tomcat Users List <us...@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

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.

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.

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.

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




Re: Trouble setting up virtual host

Posted by Hassan Schroeder <ha...@gmail.com>.
On Mon, Aug 3, 2009 at 9:00 AM, Lisa D Beggs/AC/VCU<ld...@vcu.edu> wrote:

> -->  Well you obviously chose not to read that I have gotten much further
> than the first time I posted on this forum and am well beyond the initial
> problem I was having.

No, you're *back to the original problem* you posted about, which is
what you again asked for help with just two hours ago:

> However, what I would really like to have happen is to only have to type
> in www.fmdreports.vcu.edu or fmdreports.vcu.edu and not have to type the
> /InfoViewApp after it and have set it to load the login page which is
> www.fmdreports.vcu.edu/InfoViewApp/logon.jsp

:: which was answered by my first reply. Again, two simple options:
choose one.

And nobody, as far as I've noticed, is "chastising" anyone...

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

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


Re: Trouble setting up virtual host

Posted by André Warnier <aw...@ice-sa.com>.
Lisa D Beggs/AC/VCU wrote:
> 
> -->  Well you obviously chose not to read that I have gotten much further 
> than the first time I posted on this forum and am well beyond the initial 
> problem I was having.  It's really sad that I decided to come here to get 
> the help of people who with more experience than myself and learn 
> something instead I feel I have been more chastised because of my lack of 
> knowledge.
> 
Now don't start crying.  This is a though forum, full of terrible machos 
delighting in jargon, java, servlet specs and the like.  Gotta show 
these guys some spunk, or you'll get nowhere.
Plus, you really have no reason to complain.  You've already gotten, 
from at least 3 of us, what amounts to a complete manual about posting 
to forums, the WWW, webservers, network connectivity, DNS and more.
Most of it duplicating information easily available on Google and 
computers 101.
Plus, the solution is now tantalisingly close.  It would be a pity to 
give up now.
So, what do you say ?
:-)





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


Re: Trouble setting up virtual host

Posted by Lisa D Beggs/AC/VCU <ld...@vcu.edu>.
From:
Hassan Schroeder <ha...@gmail.com>
To:
Tomcat Users List <us...@tomcat.apache.org>
Date:
08/03/2009 11:44 AM
Subject:
Re: Trouble setting up virtual host



On Mon, Aug 3, 2009 at 8:39 AM, Lisa D Beggs/AC/VCU<ld...@vcu.edu> 
wrote:

> -->  If I remember correctly, the answer you gave me is not appropriate
> for my situation.  I can not rename my application directory folder with
> ROOT.  I must keep my application directory structure.

Why? Since you don't want that structure to be apparent?

In any case, I gave you two solutions; so if you truly can't or won't
use the second, use the first.


-->  Well you obviously chose not to read that I have gotten much further 
than the first time I posted on this forum and am well beyond the initial 
problem I was having.  It's really sad that I decided to come here to get 
the help of people who with more experience than myself and learn 
something instead I feel I have been more chastised because of my lack of 
knowledge.

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



Re: Trouble setting up virtual host

Posted by Hassan Schroeder <ha...@gmail.com>.
On Mon, Aug 3, 2009 at 8:39 AM, Lisa D Beggs/AC/VCU<ld...@vcu.edu> wrote:

> -->  If I remember correctly, the answer you gave me is not appropriate
> for my situation.  I can not rename my application directory folder with
> ROOT.  I must keep my application directory structure.

Why? Since you don't want that structure to be apparent?

In any case, I gave you two solutions; so if you truly can't or won't
use the second, use the first.

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

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


Re: Trouble setting up virtual host

Posted by Lisa D Beggs/AC/VCU <ld...@vcu.edu>.
From:
Hassan Schroeder <ha...@gmail.com>
To:
Tomcat Users List <us...@tomcat.apache.org>
Date:
08/03/2009 11:28 AM
Subject:
Re: Trouble setting up virtual host



On Mon, Aug 3, 2009 at 7:31 AM, Lisa D Beggs/AC/VCU<ld...@vcu.edu> 
wrote:
> I guess nobody is willing to help me any further on the below?

I gave you the answer in the very first reply in this thread.


-->  If I remember correctly, the answer you gave me is not appropriate 
for my situation.  I can not rename my application directory folder with 
ROOT.  I must keep my application directory structure.

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

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



Re: Trouble setting up virtual host

Posted by Hassan Schroeder <ha...@gmail.com>.
On Mon, Aug 3, 2009 at 7:31 AM, Lisa D Beggs/AC/VCU<ld...@vcu.edu> wrote:
> I guess nobody is willing to help me any further on the below?

I gave you the answer in the very first reply in this thread.

-- 
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
twitter: @hassan

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


Re: Trouble setting up virtual host

Posted by André Warnier <aw...@ice-sa.com>.
Lisa D Beggs/AC/VCU wrote:
> I guess nobody is willing to help me any further on the below?

Just because you're called Lisa then...
Because, as Hassan mentioned, you already got all the answers.

There are 2 ways to do what you want.
And in both cases, your directory structure will change somewhat. 
That's how it is, no way around it.

#1 consists of renaming the existing ROOT application to something else, 
and then rename your application to ROOT.
This does not change the directory structure below whatever is the top 
directory of your application.  It just changes the top directory name 
of your application.
In other words, suppose you currently have

(tomcat installation directory)/webapps/ROOT/*
and
(tomcat installation directory)/webapps/YourApp/*

then "ROOT" should be renamed to "XYZ", and then "YourApp" should be 
renamed to ROOT.
That's it.
Except that you should stop Tomcat before you do that, and restart 
Tomcat when it's done.

#2 solution consists of using Virtual Hosts.
You already have one, although you probably don't know that.
It is represented by the single
<Host name="localhost"...>
...
</Host>
section in your server.xml.
The trick consists of creating a second one, very similar but with some 
attributes changed in it.
But anyway, in that case, you will have to move your application, which 
is currently in
(tomcat installation directory)/webapps/YourApp/*
somewhere else.

So which one do you prefer ?



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