• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to change virtual host from http://localhost/test to http://www.fakedomain.com/?

 
Chen Huang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

OS: Linux
Tomcat version: 6.0
I want to set up a virtual host for an application (webapps/test). I followed the tomcat 6 documentation:
1. in $CATALINA_HOME/conf/server.xml, add:
2. Created $CATALINA_HOME/webapps/test/ROOT/META-INF/context.xml, this was left empty

After restarting tomcat, when I visit www.fakedomain.com, I got this error:


The project is workable if using http://localhost/test.

Also if I change the server.xml as this

I was able to visit the project by using www.fakedomain/test.

I'm new to tomcat, I wonder if I missed something?

Thanks!
[ May 10, 2008: Message edited by: Chen Huang ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I set up virtual hosts, I use an absolute path for appBase.

Bill
 
Chen Huang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for writing back, I tried that, but it doesn't work...
One thing I don't understand is: why I was able to visit "www.fakedomain.com" if I change appBase to "webapps", in that case the default tomcat page will show up. Does that mean the virtual host work but I might have missed something in my own application?

Originally posted by William Brogden:
When I set up virtual hosts, I use an absolute path for appBase.

Bill
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The appBase shouldn't point to a specific app.
It points to the directory which houses the application folders.

It sounds like you've got it right if you're seeing the Tomcat home page.
Maybe you also want your application to be the default application for that host?

If so, rename your application to "ROOT".
 
Chen Huang
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot! That works.

Originally posted by Ben Souther:
The appBase shouldn't point to a specific app.
It points to the directory which houses the application folders.

It sounds like you've got it right if you're seeing the Tomcat home page.
Maybe you also want your application to be the default application for that host?

If so, rename your application to "ROOT".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic