How to have multiple domains/contexts with Tomcat ? they all go to same context ..
Hi. This is a simple question (i think) After playing with server,xml (and various other .xml files) I am unable to work out how to host multiple domains on a Tomcat 6 (standalone) server (running on port 80) .. I have read - http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html I.e - I have uploaded 2 contexts /mrpink /mrblue - mrpink was uploaded first (as root context). - I have 2 domains www.mrpink.com www.mrblue.com - both domains point to the same ip (tomcat server) - however when visiting both sites they go to the ROOT context. - I want www.mrpink.com to go to www.mrpink.com/mrpink and www.mrblue.comto go to www.mrblue.com/mrblue - how is this possible ? Please note : that both contexts are fine when you put the URL in (i.e www.mrpink.com/mrpink) - I just want Tomcat to understand when you visit www.mrpink.com to automatically goes to www.mrpink.com/mrpink I have tried editing server.xml (as shown in above link) also tried using the tomcat host-manager - every time I try to use this I get file/folder not found when visiting the page - i.e the host-manager seems to work fine but visiting the page after adding a virtual host i get a blank page (in firefox) - file/folder not found in konqueror Here is an example I tried - to get www.mrblue.com to point to www.mrblue.com/mrblue using the host-manager - First I uploaded the mrblue tomcat application using the tomcat manager.. Using host-manager ... www.mrpink.com/host-manager/html name : mrblue.com alias : www.mrblue.com app base : /opt/tomcat/webapps/mrblue/ The webapp is located in - /opt/tomcat/webapps/mrblue/ I understand I can do what I want using mod_jk - however it seems crazy using apache when I do not really need to ... Can anyone help - its slowly driving me mad.. Cheers
Re: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
Can you tell us on what kind of host system you are running this ? It would help guessing where the files are. Thanks. P.S. I am not the expert, but it should indeed be relatively simple, so I'll try. In a nutshell : - start again from the original server.xml file. - in it, locate the Host name=localhost ./Host section, copy it, and re-insert it after the original section. - then replace the name=localhost attribute by name=www.mrpink.com - then redo the same one more time, this time with www.mrblue.com The above takes care of letting Tomcat known that there are 3 Virtual Hosts : - www.mrpink.com - www.mrblue.com - and localhost, which will also be (remain) the Host by default, if the name given in the request does not match either of the other ones (for example, if someone calls up http://xxx.xxx.xxx.xxx:8180 (with the IP address of your server). (I suggest to keep that one as it is, to access the documentation etc..) Now what is left is to tell Tomcat where, for each of the virtual hosts, he finds the corresponding documents and webapps. I would recommend to create 2 additional directories, at the same level as your current webapps, say webapps-pink and webapps-blue. Then move the respective documents/applications in these directories, checking ownership and permissions etc.. They must at least be readable by the user-id running Tomcat. Now go back to your individual Hosts sections, and change appBase=webapps by appBase=webapps-pink and appBase=webapps-blue Now restart Tomcat. You should now be able to access blue by calling up http://www.mrblue.com/mrblue;. To make this trailing /mrblue go away, you should make this webapp into the ROOT webapp for that virtual server, but for that I'll let an expert give you the instructions. Have I got it right ? Morgan Cox wrote: Hi. This is a simple question (i think) After playing with server,xml (and various other .xml files) I am unable to work out how to host multiple domains on a Tomcat 6 (standalone) server (running on port 80) .. I have read - http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html I.e - I have uploaded 2 contexts /mrpink /mrblue - mrpink was uploaded first (as root context). - I have 2 domains www.mrpink.com www.mrblue.com - both domains point to the same ip (tomcat server) - however when visiting both sites they go to the ROOT context. - I want www.mrpink.com to go to www.mrpink.com/mrpink and www.mrblue.comto go to www.mrblue.com/mrblue - how is this possible ? Please note : that both contexts are fine when you put the URL in (i.e www.mrpink.com/mrpink) - I just want Tomcat to understand when you visit www.mrpink.com to automatically goes to www.mrpink.com/mrpink I have tried editing server.xml (as shown in above link) also tried using the tomcat host-manager - every time I try to use this I get file/folder not found when visiting the page - i.e the host-manager seems to work fine but visiting the page after adding a virtual host i get a blank page (in firefox) - file/folder not found in konqueror Here is an example I tried - to get www.mrblue.com to point to www.mrblue.com/mrblue using the host-manager - First I uploaded the mrblue tomcat application using the tomcat manager.. Using host-manager ... www.mrpink.com/host-manager/html name : mrblue.com alias : www.mrblue.com app base : /opt/tomcat/webapps/mrblue/ The webapp is located in - /opt/tomcat/webapps/mrblue/ I understand I can do what I want using mod_jk - however it seems crazy using apache when I do not really need to ... Can anyone help - its slowly driving me mad.. Cheers - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
Hi. It is on an Ubuntu Gutsy server.. As mentioned the tomcat applications are working I can just figure out to point domains at the contexts.. cheers 2008/9/26 André Warnier [EMAIL PROTECTED] Can you tell us on what kind of host system you are running this ? It would help guessing where the files are. Thanks. P.S. I am not the expert, but it should indeed be relatively simple, so I'll try. In a nutshell : - start again from the original server.xml file. - in it, locate the Host name=localhost ./Host section, copy it, and re-insert it after the original section. - then replace the name=localhost attribute by name=www.mrpink.com - then redo the same one more time, this time with www.mrblue.com The above takes care of letting Tomcat known that there are 3 Virtual Hosts : - www.mrpink.com - www.mrblue.com - and localhost, which will also be (remain) the Host by default, if the name given in the request does not match either of the other ones (for example, if someone calls up http://xxx.xxx.xxx.xxx:8180 (with the IP address of your server). (I suggest to keep that one as it is, to access the documentation etc..) Now what is left is to tell Tomcat where, for each of the virtual hosts, he finds the corresponding documents and webapps. I would recommend to create 2 additional directories, at the same level as your current webapps, say webapps-pink and webapps-blue. Then move the respective documents/applications in these directories, checking ownership and permissions etc.. They must at least be readable by the user-id running Tomcat. Now go back to your individual Hosts sections, and change appBase=webapps by appBase=webapps-pink and appBase=webapps-blue Now restart Tomcat. You should now be able to access blue by calling up http://www.mrblue.com/mrblue;. To make this trailing /mrblue go away, you should make this webapp into the ROOT webapp for that virtual server, but for that I'll let an expert give you the instructions. Have I got it right ? Morgan Cox wrote: Hi. This is a simple question (i think) After playing with server,xml (and various other .xml files) I am unable to work out how to host multiple domains on a Tomcat 6 (standalone) server (running on port 80) .. I have read - http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html I.e - I have uploaded 2 contexts /mrpink /mrblue - mrpink was uploaded first (as root context). - I have 2 domains www.mrpink.com www.mrblue.com - both domains point to the same ip (tomcat server) - however when visiting both sites they go to the ROOT context. - I want www.mrpink.com to go to www.mrpink.com/mrpink and www.mrblue.comto go to www.mrblue.com/mrblue - how is this possible ? Please note : that both contexts are fine when you put the URL in (i.e www.mrpink.com/mrpink) - I just want Tomcat to understand when you visit www.mrpink.com to automatically goes to www.mrpink.com/mrpink I have tried editing server.xml (as shown in above link) also tried using the tomcat host-manager - every time I try to use this I get file/folder not found when visiting the page - i.e the host-manager seems to work fine but visiting the page after adding a virtual host i get a blank page (in firefox) - file/folder not found in konqueror Here is an example I tried - to get www.mrblue.com to point to www.mrblue.com/mrblue using the host-manager - First I uploaded the mrblue tomcat application using the tomcat manager.. Using host-manager ... www.mrpink.com/host-manager/html name : mrblue.com alias : www.mrblue.com app base : /opt/tomcat/webapps/mrblue/ The webapp is located in - /opt/tomcat/webapps/mrblue/ I understand I can do what I want using mod_jk - however it seems crazy using apache when I do not really need to ... Can anyone help - its slowly driving me mad.. Cheers - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
Sorry - didn't see your complete response... http://www.mrblue.com/mrblu http://www.mrblue.com/mrbluee - already goes to the mrblue context - i want http://www.mrblue.comhttp://www.mrblue.com/mrblueto go the mrblue context. Thanks for the advise - it seems that I do need to set the ROOT webapp for each virtual server - anyone got any ideas of how to do this. Thanks for your response André Cheers 2008/9/26 Morgan Cox [EMAIL PROTECTED] Hi. It is on an Ubuntu Gutsy server.. As mentioned the tomcat applications are working I can just figure out to point domains at the contexts.. cheers 2008/9/26 André Warnier [EMAIL PROTECTED] Can you tell us on what kind of host system you are running this ? It would help guessing where the files are. Thanks. P.S. I am not the expert, but it should indeed be relatively simple, so I'll try. In a nutshell : - start again from the original server.xml file. - in it, locate the Host name=localhost ./Host section, copy it, and re-insert it after the original section. - then replace the name=localhost attribute by name=www.mrpink.com - then redo the same one more time, this time with www.mrblue.com The above takes care of letting Tomcat known that there are 3 Virtual Hosts : - www.mrpink.com - www.mrblue.com - and localhost, which will also be (remain) the Host by default, if the name given in the request does not match either of the other ones (for example, if someone calls up http://xxx.xxx.xxx.xxx:8180 (with the IP address of your server). (I suggest to keep that one as it is, to access the documentation etc..) Now what is left is to tell Tomcat where, for each of the virtual hosts, he finds the corresponding documents and webapps. I would recommend to create 2 additional directories, at the same level as your current webapps, say webapps-pink and webapps-blue. Then move the respective documents/applications in these directories, checking ownership and permissions etc.. They must at least be readable by the user-id running Tomcat. Now go back to your individual Hosts sections, and change appBase=webapps by appBase=webapps-pink and appBase=webapps-blue Now restart Tomcat. You should now be able to access blue by calling up http://www.mrblue.com/mrblue;. To make this trailing /mrblue go away, you should make this webapp into the ROOT webapp for that virtual server, but for that I'll let an expert give you the instructions. Have I got it right ? Morgan Cox wrote: Hi. This is a simple question (i think) After playing with server,xml (and various other .xml files) I am unable to work out how to host multiple domains on a Tomcat 6 (standalone) server (running on port 80) .. I have read - http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html I.e - I have uploaded 2 contexts /mrpink /mrblue - mrpink was uploaded first (as root context). - I have 2 domains www.mrpink.com www.mrblue.com - both domains point to the same ip (tomcat server) - however when visiting both sites they go to the ROOT context. - I want www.mrpink.com to go to www.mrpink.com/mrpink and www.mrblue.comto go to www.mrblue.com/mrblue - how is this possible ? Please note : that both contexts are fine when you put the URL in (i.e www.mrpink.com/mrpink) - I just want Tomcat to understand when you visit www.mrpink.com to automatically goes to www.mrpink.com/mrpink I have tried editing server.xml (as shown in above link) also tried using the tomcat host-manager - every time I try to use this I get file/folder not found when visiting the page - i.e the host-manager seems to work fine but visiting the page after adding a virtual host i get a blank page (in firefox) - file/folder not found in konqueror Here is an example I tried - to get www.mrblue.com to point to www.mrblue.com/mrblue using the host-manager - First I uploaded the mrblue tomcat application using the tomcat manager.. Using host-manager ... www.mrpink.com/host-manager/html name : mrblue.com alias : www.mrblue.com app base : /opt/tomcat/webapps/mrblue/ The webapp is located in - /opt/tomcat/webapps/mrblue/ I understand I can do what I want using mod_jk - however it seems crazy using apache when I do not really need to ... Can anyone help - its slowly driving me mad.. Cheers - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
Morgan Cox wrote: Sorry - didn't see your complete response... http://www.mrblue.com/mrblu http://www.mrblue.com/mrbluee - already goes to the mrblue context - i want http://www.mrblue.comhttp://www.mrblue.com/mrblueto go the mrblue context. Thanks for the advise - it seems that I do need to set the ROOT webapp for each virtual server - anyone got any ideas of how to do this. Rename $CATALINA_BASE\webapps-blue\mrblue ro $CATALINA_BASE\webapps-blue\ROOT Note that each virtual host must have its own appBase. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
From: Morgan Cox [mailto:[EMAIL PROTECTED] Subject: Re: How to have multiple domains/contexts with Tomcat ? they all go to same context .. Thanks for the advise - it seems that I do need to set the ROOT webapp for each virtual server - anyone got any ideas of how to do this. Read *all* of Andre's post - he already told you, in great detail, exactly how to do it. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
Thanks to everybody whos responded. I shall try these suggestions and let you know how it goes.. 2008/9/26 Caldarale, Charles R [EMAIL PROTECTED] From: Morgan Cox [mailto:[EMAIL PROTECTED] Subject: Re: How to have multiple domains/contexts with Tomcat ? they all go to same context .. Thanks for the advise - it seems that I do need to set the ROOT webapp for each virtual server - anyone got any ideas of how to do this. Read *all* of Andre's post - he already told you, in great detail, exactly how to do it. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
Caldarale, Charles R wrote: From: Morgan Cox [mailto:[EMAIL PROTECTED] Subject: Re: How to have multiple domains/contexts with Tomcat ? they all go to same context .. Thanks for the advise - it seems that I do need to set the ROOT webapp for each virtual server - anyone got any ideas of how to do this. Read *all* of Andre's post - he already told you, in great detail, exactly how to do it. Well, not really about making them the ROOT application. So I'll try that one too, but someone should probably come after me to clean up. Morgan, if you followed the previous instructions, you now have this directory structure : (CATALINA_HOME being the top of your Tomcat installation) CATALINA_HOME/webapps (with the standard webapps and documents from the original Tomcat installation) CATALINA_HOME/webapps-pink/mrpink/ with your pink webapp CATALINA_HOME/webapps-blue/mrblue/ with your blue webapp Turn off Tomcat. Under /webapps-pink/, rename the directory /mrpink to /ROOT (uppercase). Under /webapps-blue/, rename the directory /mrblue to /ROOT (uppercase). And restart Tomcat. And unless someone contradicts the above within the next 15 minutes, you should now be able to access your applications directly via http://www.mrpink.com[:port] and http://www.mrblue.com[:port] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
Hi André - between yours and Mark's advice I have managed to do what i needed to. Thank you all - i'm amazed at the level of response... (half expected to look in a month and see no responses.) One last thing - If you upload the .war files with the tomcat manager / host-manager is there a way to do this - or will it always involve hand editing the server.xml file (and renaming directories). ? Thanks again everybody - you've possible just saved my monitor from being throw out the window. Cheers ! 2008/9/26 André Warnier [EMAIL PROTECTED] Caldarale, Charles R wrote: From: Morgan Cox [mailto:[EMAIL PROTECTED] Subject: Re: How to have multiple domains/contexts with Tomcat ? they all go to same context .. Thanks for the advise - it seems that I do need to set the ROOT webapp for each virtual server - anyone got any ideas of how to do this. Read *all* of Andre's post - he already told you, in great detail, exactly how to do it. Well, not really about making them the ROOT application. So I'll try that one too, but someone should probably come after me to clean up. Morgan, if you followed the previous instructions, you now have this directory structure : (CATALINA_HOME being the top of your Tomcat installation) CATALINA_HOME/webapps (with the standard webapps and documents from the original Tomcat installation) CATALINA_HOME/webapps-pink/mrpink/ with your pink webapp CATALINA_HOME/webapps-blue/mrblue/ with your blue webapp Turn off Tomcat. Under /webapps-pink/, rename the directory /mrpink to /ROOT (uppercase). Under /webapps-blue/, rename the directory /mrblue to /ROOT (uppercase). And restart Tomcat. And unless someone contradicts the above within the next 15 minutes, you should now be able to access your applications directly via http://www.mrpink.com[:port] and http://www.mrblue.com[:port] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
Morgan Cox wrote: Hi André - between yours and Mark's advice I have managed to do what i needed to. Thank you all - i'm amazed at the level of response... (half expected to look in a month and see no responses.) One last thing - If you upload the .war files with the tomcat manager / host-manager is there a way to do this - or will it always involve hand editing the server.xml file (and renaming directories). ? You'll need to configure the manager webapp for each virtual host. See the end of http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html Once you have done that, if you upload a file called ROOT.war it will be treated as the ROOT application. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
From: Morgan Cox [mailto:[EMAIL PROTECTED] Subject: Re: How to have multiple domains/contexts with Tomcat ? they all go to same context .. One last thing - If you upload the .war files with the tomcat manager / host-manager is there a way to do this Once the Host elements are set up, you shouldn't have to do any more editing of server.xml - just deploy the default webapp as ROOT under each Host. However, you will have to deploy the manager app for each Host, since each instance is tied to a given Host (at least it was last time I tried). The easiest way to do that is just copy the manager directory to each of your Host's appBase directories. You can also do it by putting a Context element for each manager in conf/Catalina/[host]/manager.xml, but all that does is save a minimal amount of disk space. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
Thanks everybody for your input. I'll try to deploy the manager for each host as suggested. Cheers everybody. 2008/9/26 Caldarale, Charles R [EMAIL PROTECTED] From: Morgan Cox [mailto:[EMAIL PROTECTED] Subject: Re: How to have multiple domains/contexts with Tomcat ? they all go to same context .. One last thing - If you upload the .war files with the tomcat manager / host-manager is there a way to do this Once the Host elements are set up, you shouldn't have to do any more editing of server.xml - just deploy the default webapp as ROOT under each Host. However, you will have to deploy the manager app for each Host, since each instance is tied to a given Host (at least it was last time I tried). The easiest way to do that is just copy the manager directory to each of your Host's appBase directories. You can also do it by putting a Context element for each manager in conf/Catalina/[host]/manager.xml, but all that does is save a minimal amount of disk space. - 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 start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How to have multiple domains/contexts with Tomcat ? they all go to same context ..
- Original Message - From: André Warnier [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Friday, September 26, 2008 12:10 PM Subject: Re: How to have multiple domains/contexts with Tomcat ? they all go to same context .. Can you tell us on what kind of host system you are running this ? It would help guessing where the files are. Thanks. P.S. I am not the expert, but it should indeed be relatively simple, so I'll try. In a nutshell : - start again from the original server.xml file. - in it, locate the Host name=localhost ./Host section, copy it, and re-insert it after the original section. - then replace the name=localhost attribute by name=www.mrpink.com - then redo the same one more time, this time with www.mrblue.com The above takes care of letting Tomcat known that there are 3 Virtual Hosts : - www.mrpink.com - www.mrblue.com - and localhost, which will also be (remain) the Host by default, if the name given in the request does not match either of the other ones (for example, if someone calls up http://xxx.xxx.xxx.xxx:8180 (with the IP address of your server). (I suggest to keep that one as it is, to access the documentation etc..) Now what is left is to tell Tomcat where, for each of the virtual hosts, he finds the corresponding documents and webapps. I would recommend to create 2 additional directories, at the same level as your current webapps, say webapps-pink and webapps-blue. Then move the respective documents/applications in these directories, checking ownership and permissions etc.. They must at least be readable by the user-id running Tomcat. Now go back to your individual Hosts sections, and change appBase=webapps by appBase=webapps-pink and appBase=webapps-blue Now restart Tomcat. You should now be able to access blue by calling up http://www.mrblue.com/mrblue;. To make this trailing /mrblue go away, you should make this webapp into the ROOT webapp for that virtual server, but for that I'll let an expert give you the instructions. Have I got it right ? Any better... and we'll have to pay you a consulting fee ;) --- HARBOR : http://www.kewlstuff.co.za/index.htm The most powerful application server on earth. The only real POJO Application Server. See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm --- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]