You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Pradeep <ch...@gmail.com> on 2012/09/24 15:41:00 UTC

Fwd: Problem with hosting mulitple websites on single tomcat 7

I have one domain hosted on cloud server. Let's say o.com

Now i want to add a.com and b.com to same cloud server, for that , i added
host entries inside server.xml as below,

<Host name="localhost"  appBase="webapps"



            unpackWARs="true" autoDeploy="true">



        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->



        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />



        -->

        <!-- Access log processes all example.



             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->



        <Valve className="org.apache.catalina.valves.AccessLogValve"
directory="logs"



               prefix="localhost_access_log." suffix=".txt"



               pattern="%h %l %u %t &quot;%r&quot; %s %b" />



      </Host>



  <Host name="a.com" appBase="webapps_a"></Host>



 <Host name="b.com" appBase="webapps_b"></Host>

 (Note, Localhost was the orignal entry)

But , problem is , they both are pointing to o.com and not to their
respective domains/webapp directories


Thank you for providing such great tool.




-- 
Thanks & Regards,
Pradeep Chaudhari

RE: Problem with hosting mulitple websites on single tomcat 7

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: chaudharipradeep9@gmail.com [mailto:chaudharipradeep9@gmail.com] 
> Subject: Re: Problem with hosting mulitple websites on single tomcat 7

Don't top post.

> It goes to o.com

So much for the admonition to "be precise"...  What "it" are you talking about?  What client are you using?  Where is the client relative to the Tomcat server?  What are the answers to Konstantin's questions?

> Sent from BlackBerry(r) on Airtel

That explains a lot.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: Problem with hosting mulitple websites on single tomcat 7

Posted by Mark Eggers <it...@yahoo.com>.
On 9/24/2012 8:00 AM, chaudharipradeep9@gmail.com wrote:
> It goes to o.com
> Sent from BlackBerry® on Airtel
>
> -----Original Message-----
> From: "Caldarale, Charles R" <Ch...@unisys.com>
> Date: Mon, 24 Sep 2012 09:59:19
> To: Tomcat Users List<us...@tomcat.apache.org>
> Reply-To: "Tomcat Users List" <us...@tomcat.apache.org>
> Subject: RE: Problem with hosting mulitple websites on single tomcat 7
>
>> From: Pradeep [mailto:chaudharipradeep9@gmail.com]
>> Subject: Fwd: Problem with hosting mulitple websites on single tomcat 7
>
>>   <Host name="a.com" appBase="webapps_a"></Host>
>>   <Host name="b.com" appBase="webapps_b"></Host>
>
>> they both are pointing to o.com and not to their
>> respective domains/webapp directories
>
> What does the above statement mean?  Be precise.  What "they" are you referring to?  What do you mean by "pointing to"?  What actually happens when you send a request to http://a.com or http://b.com?
>
>   - Chuck

Pradeep,

In order for people on the list to help you help yourself to get the 
configuration working, some information is necessary. More information 
is almost always better than less information.

First of all, you might want to review the following Wiki article. 
Although it mentions development, the same environment with very little 
modification works as a production platform.

http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts

In particular, putting your web applications in CATALINA_BASE/webapps_a, 
CATALINA_BASE/webapps_b, etc. is probably a bit messy.

Now, some questions.

1. Exact version of Tomcat

You can get this by running ./catalina.sh version on the command line in 
the CATALINA_BASE/bin directory.

2. Exact version of JRE

The above command will also print this out

3. What is the configuration of your machine?

Are there multiple NIC cards, multiple IP addresses using virtual 
interfaces, are you using CNAMEs in DNS, or what?

4. How is your firewall rule written to forward port 80 to port 8080?

5. How are your Connector elements configured?

Paste each active Connector (more than one?) into the body of the mail 
message.

6. Access logs for all hosts would help

Add access logging for each host. Something like the following might be 
useful.

<Valve className="org.apache.catalina.valves.AccessLogValve"
        directory="logs"
        prefix="a.com-access." suffix=".log"
        pattern="%h %l %u %t &quot;%r&quot; %s %b" />

And one like this for b.com . . . .

7. How are you accessing the other hosts?

This goes back to question 3. For example, if you're testing by going 
after the IP address, then all you're probably going to get is the 
default host.

If you're using the same name that is listed in your server.xml, then 
things SHOULD work (at least on my and countless other systems, this works).

8. When you access each of the hosts, what do the three access logs show?

Access o.com - what's in all three logs
Access a.com - what's in all three logs
Access b.com - what's in all three logs

In short, more information is needed in order for people on the list to 
be helpful.

. . . ok, so maybe not so short
/mde/

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


Re: Problem with hosting mulitple websites on single tomcat 7

Posted by ch...@gmail.com.
It goes to o.com
Sent from BlackBerry® on Airtel

-----Original Message-----
From: "Caldarale, Charles R" <Ch...@unisys.com>
Date: Mon, 24 Sep 2012 09:59:19 
To: Tomcat Users List<us...@tomcat.apache.org>
Reply-To: "Tomcat Users List" <us...@tomcat.apache.org>
Subject: RE: Problem with hosting mulitple websites on single tomcat 7

> From: Pradeep [mailto:chaudharipradeep9@gmail.com] 
> Subject: Fwd: Problem with hosting mulitple websites on single tomcat 7

>  <Host name="a.com" appBase="webapps_a"></Host>
>  <Host name="b.com" appBase="webapps_b"></Host>

> they both are pointing to o.com and not to their
> respective domains/webapp directories

What does the above statement mean?  Be precise.  What "they" are you referring to?  What do you mean by "pointing to"?  What actually happens when you send a request to http://a.com or http://b.com?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: Problem with hosting mulitple websites on single tomcat 7

Posted by ch...@gmail.com.
+1 more thing,
I have also added  ip table entries for forwarding all port 80 requests to 8080

Sent from BlackBerry® on Airtel

-----Original Message-----
From: chaudharipradeep9@gmail.com
Date: Mon, 24 Sep 2012 15:00:50 
To: Tomcat Users List<us...@tomcat.apache.org>
Reply-To: chaudharipradeep9@gmail.com
Subject: Re: Problem with hosting mulitple websites on single tomcat 7

It goes to o.com
Sent from BlackBerry® on Airtel

-----Original Message-----
From: "Caldarale, Charles R" <Ch...@unisys.com>
Date: Mon, 24 Sep 2012 09:59:19 
To: Tomcat Users List<us...@tomcat.apache.org>
Reply-To: "Tomcat Users List" <us...@tomcat.apache.org>
Subject: RE: Problem with hosting mulitple websites on single tomcat 7

> From: Pradeep [mailto:chaudharipradeep9@gmail.com] 
> Subject: Fwd: Problem with hosting mulitple websites on single tomcat 7

>  <Host name="a.com" appBase="webapps_a"></Host>
>  <Host name="b.com" appBase="webapps_b"></Host>

> they both are pointing to o.com and not to their
> respective domains/webapp directories

What does the above statement mean?  Be precise.  What "they" are you referring to?  What do you mean by "pointing to"?  What actually happens when you send a request to http://a.com or http://b.com?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


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


RE: Problem with hosting mulitple websites on single tomcat 7

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Pradeep [mailto:chaudharipradeep9@gmail.com] 
> Subject: Fwd: Problem with hosting mulitple websites on single tomcat 7

>  <Host name="a.com" appBase="webapps_a"></Host>
>  <Host name="b.com" appBase="webapps_b"></Host>

> they both are pointing to o.com and not to their
> respective domains/webapp directories

What does the above statement mean?  Be precise.  What "they" are you referring to?  What do you mean by "pointing to"?  What actually happens when you send a request to http://a.com or http://b.com?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: Problem with hosting mulitple websites on single tomcat 7

Posted by Pradeep <ch...@gmail.com>.
Hi  Konstantin ,
    Here are the details ,

     1. Tomcat Version   - Server version: Apache Tomcat/7.0.21
     2.  It is Standalone
     3. I am just using default setting ,  it is running on 8080 ,
         Only thing ,i have added following entries to forward all 80
requests to 8080
            Entries are,
        iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT
--to-ports 8080

iptables -t nat -A OUTPUT -p tcp --dport 80 -j REDIRECT --to-ports 8080


     4. Yes I restarted tomcat for every change i was testing
     5. How did i tested,
            I just visited *a.com* and *b.com* and checked whether they go
to their respective website, instead they directed to  o.com ( default app
which in webapps)

      Here is the directory structure for above three domains

         o.com   webapps
         a.com  webapps_a
         b.com webapps_b

They all are at same level

Sorry, for top posting ,i new to mailing list, i will try to avoid  in
future :) , appreciate your help.

Regards,
Pradeep

On Mon, Sep 24, 2012 at 7:37 PM, Konstantin Kolinko
<kn...@gmail.com>wrote:

> 2012/9/24 Pradeep <ch...@gmail.com>:
> > I have one domain hosted on cloud server. Let's say o.com
> >
> > Now i want to add a.com and b.com to same cloud server, for that , i
> added
> > host entries inside server.xml as below,
> >
> > <Host name="localhost"  appBase="webapps"
> >
> >
> >
> >             unpackWARs="true" autoDeploy="true">
> >
> >
> >
> >         <!-- SingleSignOn valve, share authentication between web
> applications
> >              Documentation at: /docs/config/valve.html -->
>
> There is no need to cite comments, such as one above.
>
> >
> >         <Valve className="org.apache.catalina.valves.AccessLogValve"
> > directory="logs"
> >                prefix="localhost_access_log." suffix=".txt"
> >                pattern="%h %l %u %t &quot;%r&quot; %s %b" />
> >       </Host>
> >
> >   <Host name="a.com" appBase="webapps_a"></Host>
> >  <Host name="b.com" appBase="webapps_b"></Host>
> >
> >  (Note, Localhost was the orignal entry)
> >
> > But , problem is , they both are pointing to o.com and not to their
> > respective domains/webapp directories
> >
>
> 1. What x.y.z version of Tomcat it is?
> 2. Is your Apache Tomcat running standalone, or behind Apache HTTPD or
> similar?
> 3. How are your <Connector>s configured?
> 4. Did you restart Tomcat after making your changes?
> 5. You say it does not work. - How did you test it?
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>


-- 
Thanks & Regards,
Pradeep Chaudhari

Re: Problem with hosting mulitple websites on single tomcat 7

Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/9/24 Pradeep <ch...@gmail.com>:
> I have one domain hosted on cloud server. Let's say o.com
>
> Now i want to add a.com and b.com to same cloud server, for that , i added
> host entries inside server.xml as below,
>
> <Host name="localhost"  appBase="webapps"
>
>
>
>             unpackWARs="true" autoDeploy="true">
>
>
>
>         <!-- SingleSignOn valve, share authentication between web applications
>              Documentation at: /docs/config/valve.html -->

There is no need to cite comments, such as one above.

>
>         <Valve className="org.apache.catalina.valves.AccessLogValve"
> directory="logs"
>                prefix="localhost_access_log." suffix=".txt"
>                pattern="%h %l %u %t &quot;%r&quot; %s %b" />
>       </Host>
>
>   <Host name="a.com" appBase="webapps_a"></Host>
>  <Host name="b.com" appBase="webapps_b"></Host>
>
>  (Note, Localhost was the orignal entry)
>
> But , problem is , they both are pointing to o.com and not to their
> respective domains/webapp directories
>

1. What x.y.z version of Tomcat it is?
2. Is your Apache Tomcat running standalone, or behind Apache HTTPD or similar?
3. How are your <Connector>s configured?
4. Did you restart Tomcat after making your changes?
5. You say it does not work. - How did you test it?

Best regards,
Konstantin Kolinko

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