There is another approach, which is what I use.  I presume that you are
using some kind of web programming language such as ASP, ColdFusion (which
I use) or something like that. All (I believe) web servers maintain a list
of CGI Variables, one of which is:

SERVER_NAME Your server's fully qualified domain name (e.g. www.cgi101.com)

ColdFusion and I presume others allow you access to this variable.  I then
wrote a little program which is set up as the home page for all sites on my
server.  This little program then accesses the SERVER_NAME that was called
in the URL.  If this variable is www.Site1.com control is transferred to
the directory/home page for Site1.  If it is www.Site2.com it goes to the
directory/home page for Site 2.  I have hosted as many as twenty two
entirely separate sites using this technique.

I presume that you don't want to have twenty two separate tomcat instances
running on your server.

John Matlock

On Fri, Mar 4, 2016 at 2:55 PM, Jeffrey Janner <jeffrey.jan...@polydyne.com>
wrote:

> > -----Original Message-----
> > From: Christopher Schultz [mailto:ch...@christopherschultz.net]
> > Sent: Friday, March 04, 2016 3:36 PM
> > To: Tomcat Users List <users@tomcat.apache.org>
> > Subject: Re: Multiple domian names one web site different content
> >
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> >
> > Jose,
> >
> > On 3/4/16 3:46 PM, Jose María Zaragoza wrote:
> > > Maybe my question does't have to do with current thread ( an
> > > probably doesn't have any sense at all) but :
> > >
> > > would be possible to define "VirtualHost" according the destination
> > > port ? I know that VirtualHost diferent domain name, but i want to
> > > keep the same domain name and to define 2 connectors , listening on
> > > 8080 and 8081 Requests to 8080 go to /webapps-app1 and requests to
> > > 8081 go to /webapps-app2
> > >
> > > is it possible in a only one Tomcat instance ? or  I need to
> > > configure 2 tomcat instances ?
> >
> > You would need to configure Tomcat to listen on two different
> > interfaces (or two different ports as you have above), plus have those
> > <Connectors> in separate <Service>s in Tomcat's configuration so their
> > <Host>s wouldn't interfere.
> >
> > More trouble than it's worth IMO.
> >
> > - -chris
>
> Chris's approach is correct.  That's the only way to separate <Connectors>
> by <Host>.
> If you are stuck with that approach for some reason, it's what you'd need
> to do.  But might as well have two separate tomcat instances.  After all,
> that is what setting up multiple <Service> configs is really accomplishing.
> The only advantage this gives you is if you are tight on memory and need
> to share the JVM's heap space between the webapp. (note: this only shares
> the memory, neither has access to the other's objects.)
> Used to do this for some smallish webapps on Windows, primarily to give
> each webapp/host it's own connector set for 80/443 without having to do
> dances around that default host stuff.
> Nowadays, I'm on linux with a load-balancing front-end that can properly
> serve the correct SSL certificate, so it's not so important.
>
> Jeff
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to