You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Conway Liu <cl...@xtra.co.nz> on 2011/02/02 01:38:21 UTC

How to serve .net and java websites on Windows 2008 with IIS7 and Tomcat

Hi,

We are trying to setup a webserver that will serve multiple aspx (..Net) websites 
and and jsp (Java) websites.
The webserver is a Windows 2008 R2 64 bit machine with IIS7.
I have also installed Tomcat 6.0.30 running as a service. The sample web 
application works with no problem on http://localhost:8080

Multiple IP addresses have been created on the webserver, so that each IP 
address will be used for one website.
All websites should be running on port 80, regardless if aspx website or jsp 
website.
I believe to achieve this, we need to use the Tomcat connector for IIS, so that 
IIS will take the request and forward to Tomcat to server jsp pages.

I have gone through 
http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html
and http://www.iisadmin.co.uk/?p=72
and successfully got IIS7 to pass request to Tomcat and served the sample jsp 
pages on port 80.
Then I'm stuck...

It seems like the Tomcat service only serves applications from one location 
($CATALINA_HOME)
But we don't want to run the website as
www.ourserver.com/website1
www.ourserver.com/website2

Instead, we need to run them as
www.website1.com
www.website2.com
which is why we have created multiple IP addresses on the server.

And the jsp websites will sit in seperate physical folders on the server, for 
example:
C:\website1\
C:\website2\

I've tried to play around with workers.properties, uriworkermap.properties, but 
without success.
I think there's something to do with $CATALINA_BASE that I need to configure, 
but I don't know how.
So now I beg to know exactly what and how to configure for both jsp websites to 
be served by the Tomcat service, receiving request from IIS7.

If you can give as much detail as possible or point me to any websites that have 
detailed information on this matter, I am forever greatful.

Regards and thanks
Conway

Re: How to serve .net and java websites on Windows 2008 with IIS7 and Tomcat

Posted by Thomas Strauß <t....@srs-management.de>.
Hi,

if I understand your issue right, you want to put the URL into the mapping in the URIworkermapping properties

instead of 

/someApp1|/*=worker1
/someApp2|/*=worker2

you write

/app1.you.com|/*=worker1
/app2.you.com|/*=worker2

This way, you can address the tomcat workers with different domains, resolved by the IIS. Works also with IIS as an SSL filter.

Regards,

Thomas

Am 02.02.2011 um 01:38 schrieb Conway Liu:

> Hi,
> 
> We are trying to setup a webserver that will serve multiple aspx (..Net) websites 
> and and jsp (Java) websites.
> The webserver is a Windows 2008 R2 64 bit machine with IIS7.
> I have also installed Tomcat 6.0.30 running as a service. The sample web 
> application works with no problem on http://localhost:8080
> 
> Multiple IP addresses have been created on the webserver, so that each IP 
> address will be used for one website.
> All websites should be running on port 80, regardless if aspx website or jsp 
> website.
> I believe to achieve this, we need to use the Tomcat connector for IIS, so that 
> IIS will take the request and forward to Tomcat to server jsp pages.
> 
> I have gone through 
> http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html
> and http://www.iisadmin.co.uk/?p=72
> and successfully got IIS7 to pass request to Tomcat and served the sample jsp 
> pages on port 80.
> Then I'm stuck...
> 
> It seems like the Tomcat service only serves applications from one location 
> ($CATALINA_HOME)
> But we don't want to run the website as
> www.ourserver.com/website1
> www.ourserver.com/website2
> 
> Instead, we need to run them as
> www.website1.com
> www.website2.com
> which is why we have created multiple IP addresses on the server.
> 
> And the jsp websites will sit in seperate physical folders on the server, for 
> example:
> C:\website1\
> C:\website2\
> 
> I've tried to play around with workers.properties, uriworkermap.properties, but 
> without success.
> I think there's something to do with $CATALINA_BASE that I need to configure, 
> but I don't know how.
> So now I beg to know exactly what and how to configure for both jsp websites to 
> be served by the Tomcat service, receiving request from IIS7.
> 
> If you can give as much detail as possible or point me to any websites that have 
> detailed information on this matter, I am forever greatful.
> 
> Regards and thanks
> Conway
> -- 
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
> 


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


Re: How to serve .net and java websites on Windows 2008 with IIS7 and Tomcat

Posted by Rainer Frey <ra...@inxmail.de>.
On Wednesday 02 February 2011 01:51:51 Jordan Michaels wrote:

Please don't top post.

> On 02/01/2011 04:38 PM, Conway Liu wrote:
> > It seems like the Tomcat service only serves applications from one
> > location ($CATALINA_HOME)

No. you can have
* webapps with a document path outside $CATALINA_HOME/$CATALINA_BASE
* (virtual) hosts with an appBase (base directory of all webapps of this host) 
outside $CATALINA_HOME/$CATALINA_BASE
* multiple tomcat instances with their webapps,configuration,logs ... in their 
own $CATALINA_BASE (and have their appBase/docPath outside this one 
$CATALINA_BASE)

> > Instead, we need to run them as
> > www.website1.com
> > www.website2.com
> > which is why we have created multiple IP addresses on the server.
> > 
> > And the jsp websites will sit in seperate physical folders on the server,
> > for example:
> > C:\website1\
> > C:\website2\

> A simple answer to your question is to create additional <Host> entries
> to your Tomcat server.xml file. 

That's the way to go.

> While I know that there are some on this
> list who disagree with this method, I personally find that configuring
> hosts and contexts in the server.xml file very simple as it makes adding
> new hosts to Tomcat similar to adding new hosts in Apache.

Hosts are usually configured in server.xml (unless you use some kind  of 
dynamic/programmatic configuration).

With contexts, it's not  "some on this list who disagree", it is "Tomcat 
developers discourage this method in the official documentation". It still 
works as of Tomcat 6 and 7 though.

>          <Host name="ourserver.com" appBase="webapps"
>               unpackWARs="true" autoDeploy="true"
>               xmlValidation="false" xmlNamespaceAware="false">
>               <Context path="" docBase="C:\website1\" />
>               <Alias>www.ourserver.com</Alias>
>          </Host>

You can achieve the same with:
<tomcat>/conf/server.xml:
          <Host name="example.com" appBase="example.com-webapps"
               unpackWARs="true" autoDeploy="true"
               xmlValidation="false" xmlNamespaceAware="false">
               <Alias>www.example.com</Alias>
          </Host>

<tomcat>/conf/Catalina/example.com/ROOT.xml:
<Context docBase="C:\website1\" />

Notes:
* appBase must be different for every host. Better take care of that even if 
you mean to deploy outside the appBase. appBase can also refer to a  path 
outside the tomcat directory structure.
* if you need/want the Tomcat manager app, you need to deploy it in each host
* if you have no specific reasons for your directory structure (like existing 
backup or fileserver infrastructure), you can as well deploy into appBase, 
with your webbapp in a directory named <appBase>/ROOT or in a .war file named 
<appBase>/ROOT.war and discard above mentioned ROOT.xml. It will more closely 
match what other tomcat users/admins are used to and function the same way.

> And Tomcat will now know how to resolve each domain to it's own
> directory rather then inside the ROOT webapp.
> 
> There are other ways to configure contexts, which I'm sure folks will
> post about subsequently, but I've found this works quite well and
> whether it's the "proper" way to do it or not, it will solve your problem.

The/one major drawback is: you need to restart Tomcat completely for any 
webapp context that's added/deleted/reconfigured.
I also don't see that much of an advantage compared to context.xml config 
files.

> > I think there's something to do with $CATALINA_BASE that I need to
> > configure, but I don't know how.

You need to do that only if you want to run a separate tomcat instance for 
each webapp. Each instance has its own Tomcat configuration, and its own JVM. 
Use it only if you need/want that.

> > Regards and thanks
> > Conway
> -Jordan

Rainer

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


Re: How to serve .net and java websites on Windows 2008 with IIS7 and Tomcat

Posted by Jordan Michaels <jo...@viviotech.net>.
A simple answer to your question is to create additional <Host> entries 
to your Tomcat server.xml file. While I know that there are some on this 
list who disagree with this method, I personally find that configuring 
hosts and contexts in the server.xml file very simple as it makes adding 
new hosts to Tomcat similar to adding new hosts in Apache.

For example, you can add the following to your server.xml file:

         <Host name="[ENTER DOMAIN NAME]" appBase="webapps"
              unpackWARs="true" autoDeploy="true"
              xmlValidation="false" xmlNamespaceAware="false">
              <Context path="" docBase="[ENTER SYSTEM PATH]" />
              <Alias>[ENTER ALTERNATE DOMAINS]</Alias>
         </Host>

or... more specifically:

         <Host name="ourserver.com" appBase="webapps"
              unpackWARs="true" autoDeploy="true"
              xmlValidation="false" xmlNamespaceAware="false">
              <Context path="" docBase="C:\website1\" />
              <Alias>www.ourserver.com</Alias>
         </Host>

And Tomcat will now know how to resolve each domain to it's own 
directory rather then inside the ROOT webapp.

There are other ways to configure contexts, which I'm sure folks will 
post about subsequently, but I've found this works quite well and 
whether it's the "proper" way to do it or not, it will solve your problem.

-Jordan



On 02/01/2011 04:38 PM, Conway Liu wrote:
> Hi,
>
> We are trying to setup a webserver that will serve multiple aspx (..Net) websites
> and and jsp (Java) websites.
> The webserver is a Windows 2008 R2 64 bit machine with IIS7.
> I have also installed Tomcat 6.0.30 running as a service. The sample web
> application works with no problem on http://localhost:8080
>
> Multiple IP addresses have been created on the webserver, so that each IP
> address will be used for one website.
> All websites should be running on port 80, regardless if aspx website or jsp
> website.
> I believe to achieve this, we need to use the Tomcat connector for IIS, so that
> IIS will take the request and forward to Tomcat to server jsp pages.
>
> I have gone through
> http://tomcat.apache.org/connectors-doc/webserver_howto/iis.html
> and http://www.iisadmin.co.uk/?p=72
> and successfully got IIS7 to pass request to Tomcat and served the sample jsp
> pages on port 80.
> Then I'm stuck...
>
> It seems like the Tomcat service only serves applications from one location
> ($CATALINA_HOME)
> But we don't want to run the website as
> www.ourserver.com/website1
> www.ourserver.com/website2
>
> Instead, we need to run them as
> www.website1.com
> www.website2.com
> which is why we have created multiple IP addresses on the server.
>
> And the jsp websites will sit in seperate physical folders on the server, for
> example:
> C:\website1\
> C:\website2\
>
> I've tried to play around with workers.properties, uriworkermap.properties, but
> without success.
> I think there's something to do with $CATALINA_BASE that I need to configure,
> but I don't know how.
> So now I beg to know exactly what and how to configure for both jsp websites to
> be served by the Tomcat service, receiving request from IIS7.
>
> If you can give as much detail as possible or point me to any websites that have
> detailed information on this matter, I am forever greatful.
>
> Regards and thanks
> Conway

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