On Fri, 2016-03-04 at 21:46 +0100, 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 there an implied requirement that host:8080/webapp1 should be serviced ONLY on 8080 and likewise for 8081/webapp2? If so I think a config along these lines would work: <Server ...> <Service name="SvcOne" ...> <Connector port="8080" .../> <Engine name="SvcOneEngine" ...> <Host name="host1" appBase="${app-base1}" .../> </Engine> </Service> <Service name="SvcTwo" ...> <Connector port="8081" .../> <Engine name="SvcTwoEngine" ...> <Host name="host1" appBase="${app-base2}" .../> </Engine> </Service> </Server> where ${app-base1} and ${app-base2} are distinct non-nested directories and webapp1 and webapp2 are located within the respective app-bases. But read the Configuration reference for details. http://tomcat.apache.org/tomcat-8.0-doc/config/ Depending on which version of Tomcat you're using. > is it possible in a only one Tomcat instance ? or I need to configure > 2 tomcat instances ? > > Thanks and regards > > > > > > > 2016-03-04 19:11 GMT+01:00 Christopher Schultz <ch...@christopherschultz.net>: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Andrew, > > > > On 3/4/16 7:44 AM, Andrew Hardy wrote: > >> New to web servers. > > > > Welcome. > > > >> This may be a spring MVC question rather than tomcat, I'm not > >> sure. > >> > >> I understand I can map multiple domains to a single ip address > >> using DNS. I have read some stuff on how to set up multiple > >> virtual hosts on the same host (ip address) on tomcat which > >> requests can be diverted to depending on which domain name was used > >> to make the request. > >> > >> Alternatively I am wondering about not having multiple virtual > >> hosts (which I am guessing would be more useful if there was > >> significant difference between between the sites) but have a single > >> site which has a single layout structure etc but serves up > >> specifically tailored content from a selected content store BASED > >> on the domain used to make the request. > >> > >> Is this anything to do with tomcat or do I have to some how tell > >> which domain was used when the http session is begun and set which > >> content at that point using spring MVC. Perhaps the (first) > >> request / session includes the domain used and I so need to access > >> that programatically? > > > > You mean one single instance of the application that handles the > > hostname of the request to make decisions? Sounds good, and doesn't > > really involve Tomcat. > > > > If you have a session contained in a single web application, you could > > either store the initial server hostname in the session and use that > > until the session ends, or you could always pull the hostname from > > each incoming request. Presumably, it won't be changing. Or, you could > > cross-check those hostnames and maybe change configuration or complain > > and log the user out in that event. > > > > Again, not much to do with Tomcat, which will just route all > > appropriate requests to your application. > > > >> Is there a reason for this situation that I should not do things > >> the way I suggest? but should use multiple "identical duplicate" > >> web sites (virtual hosts) apart from each of which being hard coded > >> to access a specific content store? > > > > For me, it always comes down to complexity. If you know you can do > > this with a webapp-per-domain, then that's certainly a possibility but > > you'll need more heap space for multiple web applications, and so you > > might not scale as well. > > > > On the other hand, you may have to significantly re-work your web > > application to be able to handle one-single-webapp that can > > auto-switch configuration based upon the client's server-hostname. If > > that's the case, then running a single-application represents more > > risk -- at least for now. > > > > If I were designing things from scratch and I knew I'd be supporting > > marge numbers of configurations, I'd go with the > > single-webapp-instance approach because it's more scalable. > > > > - -chris > > -----BEGIN PGP SIGNATURE----- > > Comment: GPGTools - http://gpgtools.org > > Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ > > > > iEYEARECAAYFAlbZz9oACgkQ9CaO5/Lv0PD0mQCfShH1CZqKimD+mwBpOJimFMvt > > qpgAni7S3D76ekXUrChiIfHZKRisUOsK > > =jNpf > > -----END PGP SIGNATURE----- > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > > For additional commands, e-mail: users-h...@tomcat.apache.org > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org