Re: Multiple domian names one web site different content
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 > > in separate s in Tomcat's configuration so their > > s wouldn't interfere. > > > > More trouble than it's worth IMO. > > > > - -chris > > Chris's approach is correct. That's the only way to separate > by . > 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 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 > >
RE: Multiple domian names one web site different content
> -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 > in separate s in Tomcat's configuration so their > s wouldn't interfere. > > More trouble than it's worth IMO. > > - -chris Chris's approach is correct. That's the only way to separate by . 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 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
Re: Multiple domian names one web site different content
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: 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: > > -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 >
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 in separate s in Tomcat's configuration so their s wouldn't interfere. More trouble than it's worth IMO. - -chris -BEGIN PGP SIGNATURE- Comment: GPGTools - http://gpgtools.org Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlbZ/7QACgkQ9CaO5/Lv0PCkSACeMSZQwKieHP+h3caeV+aKVKnN 3BYAoMRm2Y/fKndlsCsti72ujxKP7wi2 =Yxuf -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
RE: Multiple domian names one web site different content
> From: David kerber [mailto:dcker...@verizon.net] > Subject: Re: Multiple domian names one web site different content > No, one tomcat instance can't listen on two different ports at the same > time. ??? If that were true, Tomcat couldn't support both HTTP and HTTPS. Simply configure multiple elements, one for each desired port number. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Multiple domian names one web site different content
On 3/4/2016 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 ? No, one tomcat instance can't listen on two different ports at the same time. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Multiple domian names one web site different content
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 ? Thanks and regards 2016-03-04 19:11 GMT+01:00 Christopher Schultz: > -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
Re: Multiple domian names one web site different content
Thank you do much Chris, I really appreciate your input and taking the time to respond. Sent with AquaMail for Android http://www.aqua-mail.com On 4 March 2016 18:12:11 Christopher Schultzwrote: -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
Re: Multiple domian names one web site different content
-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