This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Tomcat and the fly likes virtual host in tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "virtual host in tomcat " Watch "virtual host in tomcat " New topic
Author

virtual host in tomcat

Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
Hello all

for demo purpose i need to set up 2 virtual hosts in tomcat

now i tried like million times to fallow simple tutorials about setting up virtual host but with no success

for example i like to set virtual host that will point to tomcat : webapps\tomcat-docs\appdev\sample\web

now this is what i did :


but when i try to serf in IE with www.my.com

its not going noware .... what todo? or what im doing wrong here ?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60766
    
  65

Do you own the domain my.com? If so, have you set up DNS servers appropriately?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
no i dont , its closed network , not connected to the internet

i tried to do this :
http://forums.rimuhosting.com/forums/showthread.php?t=10

but it still dont work
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
the error im geting :
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
When I set up virtual hosts in Tomcat 5.5.9 I use a Host entry that looks like:


Note that the appBase is an absolute directory address and there is no Context entry.

Bill
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
it still does not work , do i need configure something else ?

maybe on the pc im working on?

help me im getting crazy ...
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410



Did you verify that this directory exists?
Does it have a WEB-INF directory inside it?

If not, Tomcat will not recognize it as a valid web structure.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
What exactly does your <Host> entry look like now?
What exactly is the error that is reported?

Bill
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
Hello all and thanks for your help
it seams that defining virtual hosts based on one ip is working after i define it in the windows hosts file
BUT now i have new problem .
now i need to define 2 hosts based on 2 ips that is i defined 2 ip on my local pc then i configure in the server.xml
something like this :


and its working fine when i serf by this ip but how do i configure dns name to that ip?
thanks
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
I suspect you can figure that out from this Tomcat documentation. (warning, I have not actually done this)

Bill
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
sorry but i do not find it there ..
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12759
    
    5
Isnt there something in those docs about defining multiple aliases for a host?

I found that the Host tag uses the exact name only it won't recognize a host name if what it has is the IP numbers.

Bill
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
ok so i didn't understand it right i guess ..
the alias used to map the name to the host ip ?
is it right ?
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
hello all
i have another question can i run on the same pc 2 instances of tomcat ? on port 80
but with different ip's?
 
 
subject: virtual host in tomcat
 
Similar Threads
What is Tomcat virtual host, What is different from the Apache Tomcat?
Tomcat virtual host and struts
Tomcat 5 - 404 Error Cannot Find Servlet
Upgrading tomcat; help with context container
new to ANT, a bit confused..