This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Cloud Application Architecture Patterns: Designing, Building, and Modernizing for the Cloud and have Kyle Brown, Bobby Woolf and Joseph Yodor on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Tomcat - Host multiple sites?

 
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm hosting a few sites on my Tomcat web server and right now I've written a script (in JavaScript) that redirects the user to the correct sub directory depending on the URL they gave. Does anyone know how I can do this in the Tomcat server.xml file? Thanks in advance.
 
Saloon Keeper
Posts: 28755
211
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What you want is known as virtual hosting. There are 2 ways to do it.
1. Give each site its own unique IP address/port combination
2. Use the hostname-based targer determination that is only supported by HTTP 1.1 clients and higher.
I'm afraid I haven't attempted to do this in standalone Tomcat, so I'd have to RTFM. Using Apache/Tomcat, I setup a standard Apache <VirtualHost> directive block and translate to a unique Tomcat context for each site.
 
Chris Stewart
Ranch Hand
Posts: 184
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'll have to go with option 2. Thanks for the direction. I'll take a look through docs and Google groups.
 
reply
    Bookmark Topic Watch Topic
  • New Topic