On Fri, Mar 20, 2009 at 7:14 PM, Caldarale, Charles R <
chuck.caldar...@unisys.com> wrote:

> > From: Caldarale, Charles R
> > Subject: RE: How to make Tomcat serve/listen to one more port?
> >
> > I already told you how: create a second <Service>, and put
> > the second <Connector> and another <Host> inside that.
>
> If that's not clear, send me your server.xml, and I'll update it.  Should
> take less than a minute.


     OK, I've done it and it's working.  So for the record and for those who
are searching how to do the same thing as me, I write down the procedure
here.  Please correct me if I forgot anything.

     First, stop Tomcat service.  Then in the conf/server.xml, add the
following new "Service" element:

  <Service name="NewWebSiteAtAnotherPort">
      <Connector port="80" protocol="HTTP/1.1" connectionTimeout="20000" />

      <Engine name="NewWebSiteAtAnotherPort" defaultHost="localhost">

      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <Host name="localhost"  appBase="NewWebSite"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
      </Host>
    </Engine>
  </Service>

     Things to take care:
* <Service name=...  must be unique, with respect to those existent
"Service" elements
* <Connector port=... the new port number (of course!)
* <Engine name=...   must be unique wrt to those existent "Engine" elements
* <Host appBase=...  name of the new directory, NewWebSite here
* Then create a new webapp directory in the same parent directory as
"webapps".  The name must match what's written in appBase attribute.  Here I
call the new directory "NewWebSite".

     I'm not sure if the "Realm" element is really necessary.  So it's just
a copy-n-paste from the default one.  And I'm esp not sure if the
"resourceName" should be changed.  Here, I didn't change it but my new
website is working, so I suppose it's OK like this.

     Good luck to all.

Reply via email to