You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shahed Ali <sh...@enoor.com> on 2000/12/01 18:33:20 UTC

Virtual Hosts and Context Path Question

I am running Apache Stronghold with Virtual Hosts and Tomcat 3.1

I am using Named Hosts and have www.a.com and www.b.com both pointing to the same IP address.


Now when I go to http://www.a.com I want my DoucmentRoot to point to /usr/local/jakarta-tomcat/webapps/A_APP/index.jsp
But I also have to modify the Context Path = "" in server.xml to point to webapps/MYAPP

Now suppose I want http://www.b.com to point to /usr/local/jakarta-tomcat/webapps/B_APP/index.jsp, I would need
to also set the Context path = "" ?

How can I go about doing this ?

                                            
                                                OR


Or If I have virtual hosts using the same Tomcat Server, then do I need to keep all my jsp stuff in different contexts and 
Set up an alias in each virtual host = Context Path ?

So when I want to serve up jsp pages for site A I say http://www.a.com/siteAjsp/myapp.jsp
And when I want to serve up jsp pages for site B I say http://www.b.com/siteBjsp/myapp.jsp

Where siteAjsp , siteBjsp etc all have to be unique aliases/context-paths combinations.

Eg

NameVirtualHost 192.168.5.100

<Virtual Host 192.168.5.100>
ServerName www.a.com
DocumentRoot "/home/a"
Alias /siteAjsp "/usr/local/jakarta/tomcat/webapps/siteAjsp"
ApJServMount /siteAjsp/servlet /siteAjsp
<Location /siteAjsp/WEB-INF>
.....
</Location>
</Virtual Host>                    <<<<<<<<<<<< For this Host in server.xml Context path="/siteAjsp"  docbase = "webapps/siteAjsp"


<Virtual Host 192.168.5.100>
ServerName www.b.com
DocumentRoot "/home/a"
Alias /siteBjsp "/usr/local/jakarta/tomcat/webapps/siteBjsp"
ApJServMount /siteBjsp/servlet /siteBjsp
<Location /siteAjsp/WEB-INF>
.....
</Location>
</Virtual Host>                 <<<<<<<<<<<< For this Host in server.xml Context path="/siteBjsp"  docbase = "webapps/siteBjsp"

Thanks
Shahed