tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Eggers <its_toas...@yahoo.com>
Subject Re: Hosted environment
Date Wed, 21 Dec 2011 15:24:44 GMT
----- Original Message -----

> From: r.sriram <sriram@rstech.net>
> To: Tomcat Users List <users@tomcat.apache.org>
> Cc: 
> Sent: Wednesday, December 21, 2011 6:38 AM
> Subject: Re: Hosted environment
> 
> I went and checked, I couldn't find the e-mail where you have provided 
> the info.
> can you send it again with the steps I need to do.
> 
> Mark sent me a doc that listed the steps. I followed that.
> 
> On 12/21/2011 7:52 PM, Pid * wrote:
>>  On 21 Dec 2011, at 13:44, "r.sriram"<sriram@rstech.net>  
> wrote:
>> 
>>>  Hello,
>>> 
>>>  I followed: http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts
>>>  and made the following changes:
>>> 
>>>  C:\inetpub\vhosts\x.com\httpdocs\webapps
>>> 
>>>     added the following in Server.xml:
>>> 
>>>         <Host name="x.com"
>>> 
>>>         
> appBase="C:\inetpub\vhosts\x.com\httpdocs\webapps"
>>  Wrong.
>> 
>>>         unpackWARs="true" autoDeploy="true"
>>> 
>>>         xmlValidation="false" 
> xmlNamespaceAware="false">
>>> 
>>>         </Host>
>>> 
>>>     For virtual host x.com- copied *manager.xml* to
>>>     $CATALINA_HOME/conf/Catalina/x.com/httpdocs
>>  Why would you do that?
>> 
>> 
>>>     For virtual host x.com copied ROOT to
>>>     C:\inetpub\vhosts\x.com\httpdocs\webapps
>>> 
>>>     For virtual host x.com copied manager to
>>>     C:\inetpub\vhosts\x.com\httpdocs\webapps
>>> 
>>>  I tried all of these without httpdocs as well.
>>  What does that mean exactly?
>> 
>> 
>> 
>>>  Still when I invoke www.x.com, I get displayed Index.html that is there
>>>  in C:\inetpub\vhosts\x.com\httpdocs
>>  Yes. This is no surprise.
>> 
>>>  what am I doing wrong?
>>  Ignoring the emails I sent which tried to help you and prevent the
>>  error you are now seeing?
>> 
>> 
>>  p
>> 
>> 
>>>  Thanks.....rs
>>> 
>>> 
> ================================================================================================================On

> 12/21/2011 11:13 AM, r.sriram wrote:
>>>>  Thanks Mark.
>>>> 
>>>>  this is great. I just wanted to make sure, for each of the virtual
>>>>  hosts, I can create the webapps directory outside of Apache 
> directory
>>>>  structure can't I? e.g.
>>>> 
>>>>     C:\inetpub\vhosts\x.com\httpdocs\webapps
>>>>     C:\inetpub\vhosts\y.com\httpdocs\webapps
>>>>     C:\inetpub\vhosts\z.com\httpdocs\webapps
>>>> 
>>>>  copying ROOT will also copy the web.xml. So I am assuming the 
> web.xml
>>>>  can be customized appropriately to go to the servlet appropriate 
> for
>>>>  specific domain, correct?
>>>> 
>>>>  and working with domain names (it is all registered with dns etc.) 
> if
>>>>  I invoke www.x.com it will get directed to the appropriate ROOT, 
> pick
>>>>  up the appropriate servlet from web.xml, the classes, images,
>>>>  parameters etc. from the appropriate ROOT, correct?
>>>> 
>>>>  Thanks.....Sriram
>>>> 
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>>> 
>>>>  On 12/20/2011 11:14 PM, Mark Eggers wrote:
>>>>>  ----- Original Message -----
>>>>> 
>>>>>>  From: r.sriram<sriram@rstech.net>
>>>>>>  To: Tomcat Users List<users@tomcat.apache.org>
>>>>>>  Cc:
>>>>>>  Sent: Tuesday, December 20, 2011 1:21 AM
>>>>>>  Subject: Re: Hosted environment
>>>>>> 
>>>>>>  T hanks Andre.
>>>>>>  a few quick questions.
>>>>>> 
>>>>>>  Questions with respect to your response:
>>>>>>  Your response:
>>>>>> 
>>>>>>  <Host name="host1.domain1.com"...
>>>>>>  appBase="/path1/webapps/" ..>
>>>>>>      ...
>>>>>>  </Host>
>>>>>> 
>>>>>>  <Host name="host2.domain2.com"...
>>>>>>  appBase="/path2/webapps/" ..>
>>>>>>      ...
>>>>>>  </Host>
>>>>>> 
>>>>>>  Questions:
>>>>>> 
>>>>>>  * which is the file where I should add these lines
>>>>>>  * Is host1:www. If not what is it?
>>>>>>  * does path1, path2 etc. start at CATALINA_HOME?
>>>>>>  * Is there any other configuration change that I need to do
>>>>>> 
>>>>>>  My Situation
>>>>>>  Tomcat will be installed in directory let us say in Program 
> Files (*86)
>>>>>>  directory. That will have the web-inf directory.
>>>>>>  Each domain has its own root, let us say: 
> ..\domainX.com\httpdocs,
>>>>>>  domainY.com\httpdocs etc.
>>>>>> 
>>>>>>  Questions:
>>>>>> 
>>>>>>  * should I copy WEB-INF directory from C:\Program Files
>>>>>>     
> (x86)\apache-tomcat-6.0.33\webapps\ROOT\ to each of
>>>>>>      ..\domainX.com\httpdocs, 
> domainY.com\httpdocs etc.
>>>>>> 
>>>>>>  On 12/19/2011 1:12 PM, André Warnier wrote:
>>>>>>>    r.sriram wrote:
>>>>>>>>    Hello,
>>>>>>>>    I am setting up my multiple domains on Go Daddy. 
> In my current
>>>>>>>>  in-house
>>>>>>  windows server my Tomcat is on Program Files (86) and the 
> ROOT is in
>>>>>>  C:\Program Files 
> (x86)\apache-tomcat-6.0.33\webapps directory. That
>>>>>>  is where WEB-INF is, that is what is my actual path for all 
> files
>>>>>>  that gets
>>>>>>  picked up by my web pages (including my servlets).
>>>>>>>>    In Go Daddy, there would be different ROOTs for 
> each domain.
>>>>>>  (../<domain>/httpdocs) But there would be one Tomcat 
> installation.
>>>>>>>>    can Tomcat be installed in Program Files (86), 
> and the servlets,
>>>>>>>>  and
>>>>>>  all the files needed for the domain be placed in 
> ../<domain
>>>>>>  name>/httpdocs?
>>>>>>>>    Thanks.....Ram
>>>>>>>> 
>>>>>>>    Sure. Look at virtual hosts, here :
>>>>>>  http://tomcat.apache.org/tomcat-7.0-doc/config/host.html
>>>>>>>    (and their appBase attribute)
>>>>>>> 
>>>>>>>  <Host name="host1.domain1.com"...
>>>>>>  appBase="/path1/webapps/" ..>
>>>>>>>    ...
>>>>>>>  </Host>
>>>>>>> 
>>>>>>>  <Host name="host2.domain2.com"...
>>>>>>  appBase="/path2/webapps/" ..>
>>>>>>>    ...
>>>>>>>  </Host>
>>>>>>>    etc..
>>>>>>> 
>>>>>>>    I suggest to leave the default<Host 
> name="localhost" ..>
>>>>>>  as it is, and just add the others.
>>>>>  This might be useful:
>>>>> 
>>>>>  http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts
>>>>> 
>>>>> 
>>>>>  I've used this setup along with CATALINA_BASE / 
> CATALINA_HOME to run
>>>>>  large numbers of Tomcats in production.
>>>>> 
>>>>>  . . . . just my two cents.
>>>>>  /mde/


Well, you sort of kind of followed that.

The problem (as Pid has pointed out) is that you're overlapping what the web server serves
and what Tomcat serves.

Don't do this.

This is very insecure, and will not give you the results you want.

I'm going to assume Apache HTTPD <-- AJP --> Tomcat.

Web Server ----> DocumentRoot for each named virtual host
Tomcat     ----> appBase for each virtual host

None of the above directories should be overlapping.

Use the Wiki document I posted earlier to set up the virtual hosts for Tomcat. Again, do not
overlap where you put those directories and anything that Apache HTTPD serves.

Now, as Pid has also pointed out, you will need to configure mod_proxy, mod_proxy_ajp, or
mod_ajp to connect Apache HTTPD and Tomcat.

There is a lot of information about how to configure mod_ajp on the list, as well as a nice
sample configuration file in recent source releases of the Tomcat connectors (see the following
download page - http://tomcat.apache.org/download-connectors.cgi). Once you unpack the download,
an example can be found in the conf directory.

There are a couple of reasons to run Apache HTTPD <--> AJP <---> Tomcat. For example;
if you don't want to run Tomcat on port 80, if you serve other content (like PHP), or if you
have Apache HTTPD modules that provide functionality that Tomcat does not (some authentication
modules). If you don't have these types of requirements, then it's much easier to run Tomcat
by itself on port 80 and be done with it.

. . . . just my two cents.
/mde/

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


Mime
View raw message