Re: Multiple development sites using different ports
Hello, yesterday I set up exactly what you need You need to set up 2 services, and inside define your hosts and connectors. So here my server.xml: Server port=8005 shutdown=SHUTDOWN debug=0 Service name=inst1 Connector port=8180 minProcessors=5 maxProcessors=75 useBodyEncodingForURI=true enableLookups=true redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 useURIValidationHack=false disableUploadTimeout=true / Connector port=8009 enableLookups=false redirectPort=8443 protocol=AJP/1.3 / Engine name=Standalone defaultHost=localhost debug=0 Host name=localhost debug=0 appBase=webapps unpackWARs=true autoDeploy=true Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=www.example.com. suffix=.txt timestamp=true / Cluster className=org.apache.catalina.cluster.tcp.SimpleTcpCluster / /Host /Engine /Service Service name=inst2 Connector port=8181 minProcessors=5 maxProcessors=75 useBodyEncodingForURI=true enableLookups=true redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 useURIValidationHack=false disableUploadTimeout=true / Connector port=8010 enableLookups=false redirectPort=8443 protocol=AJP/1.3 / Engine name=Standalone defaultHost=localhost2 debug=0 Host name=localhost2 debug=0 appBase=/home/tomcat/yourapp unpackWARs=true autoDeploy=true Logger className=org.apache.catalina.logger.FileLogger directory=/home/tomcat/yourapp/logs prefix=www.example.com2. suffix=.txt timestamp=true / Cluster className=org.apache.catalina.cluster.tcp.SimpleTcpCluster / /Host /Engine /Service /Server This makes you 2 tomcats, one on loaclhost:8180 and the other on loaclhost:8181, with different folders in the filesystem where the webapps are deployed, one in /var/lib/tomcat5.5/webapps, and the other in /home/tomcat/yourapp I use tomcat 5.5, but I guess this will work on 6.0 as well. Regards, Yves On Thursday 26 June 2008, dylanmac wrote: I'd like to configure Tomcat so that I can run multiple dev websites as root relative and distinguish them via port numbers. In order words, I'd like to run http://localhost:8080/index.jsp and have that be a different site (using a different directory) than http://localhost:9800/index.jsp The reason this matters to me is because I like running my sites as root-relative. That way I can reference images, files, etc as, for example, /images/logo.png rather than having to traverse the directory structure via ../. This makes the site much more portable and accurately reflects how the site will run in production anyway (where most sites run as root). So can anyone give me a quick primer on how to configure Tomcat to use multiple ports for root-relative development? I have spent several hours researching this with no luck. I am currently running Tomcat 6.0 Thanks. - 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: Multiple development sites using different ports
So here's what I entered in my server.xml file based on various pieces of advice: Service name=instance1 Connector port=9091 protocol=HTTP/1.1 connectionTimeout=2 redirectPort=8443 / Connector port=8010 protocol=AJP/1.3 redirectPort=8443 / Engine name=Standalone defaultHost=devlocal1 debug=0 Host name=devlocal1 debug=0 appBase=webapps/devlocal1 unpackWARs=true autoDeploy=true Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=devlocal1 suffix=.txt timestamp=true / Cluster className=org.apache.catalina.cluster.tcp.SimpleTcpCluster / /Host /Engine /Service Service name=instance2 Connector port=9092 protocol=HTTP/1.1 connectionTimeout=2 redirectPort=8443 / Connector port=8011 protocol=AJP/1.3 redirectPort=8443 / Engine name=Standalone defaultHost=devlocal2 debug=0 Host name=devlocal2 debug=0 appBase=webapps/devlocal2 unpackWARs=true autoDeploy=true Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=devlocal2 suffix=.txt timestamp=true / Cluster className=org.apache.catalina.cluster.tcp.SimpleTcpCluster / /Host /Engine /Service and here's what's in my hosts file: 127.0.0.1 localhost ::1 localhost 127.0.0.1 devlocal1 127.0.0.1 devlocal2 When I try to hit either http://devlocal1/ or http://localhost:9091/ this is what I get in my browser (and yes, Tomcat was restarted) Failed to Connect Firefox can't establish a connection to the server at revfoodslocal:9091. - Dylan Caldarale, Charles R wrote: From: dylanmac [mailto:[EMAIL PROTECTED] Subject: Re: Multiple development sites using different ports I looked at name-based virtual hosts and couldn't get it working. What did you try and what didn't work? Be specific. Did you read the doc: http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html I need to configure the DNS properly for name-based virtual hosting to work. Only if you're going to expose your web sites to an uncontrolled set of clients (e.g., the Internet). Otherwise, as Hassan noted, simply update the /etc/hosts file on each client computer to include all the host names you want, all targeting the same IP address. (For Windows clients, it's in C:\WINDOWS\system32\drivers\etc\hosts.) - 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] -- View this message in context: http://www.nabble.com/Multiple-development-sites-using-different-ports-tp18139932p18163389.html Sent from the Tomcat - User mailing list archive at Nabble.com. - 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: Multiple development sites using different ports
On Fri, Jun 27, 2008 at 1:38 PM, dylanmac [EMAIL PROTECTED] wrote: Host name=devlocal1 Host name=devlocal2 and here's what's in my hosts file: 127.0.0.1 localhost ::1 localhost 127.0.0.1 devlocal1 127.0.0.1 devlocal2 When I try to hit either http://devlocal1/ or http://localhost:9091/ this is Firefox can't establish a connection to the server at revfoodslocal:9091. which doesn't match either of the above :-) In any case, you need to set up /etc/hosts like: 127.0.0.1 localhost devlocal1 devlocal2 # all host aliases for a given address on same line ::1 localhost HTH, -- Hassan Schroeder [EMAIL PROTECTED] - 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: Multiple development sites using different ports
Ha, that's embarrassing. I've been substituting real names for fake ones for the sake of this discussion and got my wires crossed in my reply. In any event, I have tried what you suggested re: the hosts file and still no dice. There is a slight difference this time, though. Rather than getting a can't establish a connection message, I get a blank page. Is that progress? 8-) Also, no log files are being created. Hassan Schroeder-2 wrote: On Fri, Jun 27, 2008 at 1:38 PM, dylanmac [EMAIL PROTECTED] wrote: Host name=devlocal1 Host name=devlocal2 and here's what's in my hosts file: 127.0.0.1 localhost ::1 localhost 127.0.0.1 devlocal1 127.0.0.1 devlocal2 When I try to hit either http://devlocal1/ or http://localhost:9091/ this is Firefox can't establish a connection to the server at revfoodslocal:9091. which doesn't match either of the above :-) In any case, you need to set up /etc/hosts like: 127.0.0.1 localhost devlocal1 devlocal2 # all host aliases for a given address on same line ::1 localhost HTH, -- Hassan Schroeder [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Multiple-development-sites-using-different-ports-tp18139932p18164537.html Sent from the Tomcat - User mailing list archive at Nabble.com. - 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: Multiple development sites using different ports
On Fri, Jun 27, 2008 at 2:51 PM, dylanmac [EMAIL PROTECTED] wrote: In any event, I have tried what you suggested re: the hosts file and still no dice. There is a slight difference this time, though. Rather than getting a can't establish a connection message, I get a blank page. Is that progress? 8-) You bet. First, ping devlocal1 and devlocal2 to make sure both names are being resolved. Then go comment out one of your Service elements and try to access the other. Tail -f the catalina.out log file, making sure your Connectors are starting properly. If that works, reverse it and try the other Service. When they're confirmed to work independently, try together. However, I'd give the Engine elements different names, and I'd get rid of the Cluster (unnecessary) and Logger (invalid) elements first... HTH, -- Hassan Schroeder [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Multiple development sites using different ports
I'd like to configure Tomcat so that I can run multiple dev websites as root relative and distinguish them via port numbers. In order words, I'd like to run http://localhost:8080/index.jsp and have that be a different site (using a different directory) than http://localhost:9800/index.jsp The reason this matters to me is because I like running my sites as root-relative. That way I can reference images, files, etc as, for example, /images/logo.png rather than having to traverse the directory structure via ../. This makes the site much more portable and accurately reflects how the site will run in production anyway (where most sites run as root). So can anyone give me a quick primer on how to configure Tomcat to use multiple ports for root-relative development? I have spent several hours researching this with no luck. I am currently running Tomcat 6.0 Thanks. -- View this message in context: http://www.nabble.com/Multiple-development-sites-using-different-ports-tp18139932p18139932.html Sent from the Tomcat - User mailing list archive at Nabble.com. - 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: Multiple development sites using different ports
On Thu, Jun 26, 2008 at 11:08 AM, dylanmac [EMAIL PROTECTED] wrote: I'd like to configure Tomcat so that I can run multiple dev websites as root relative and distinguish them via port numbers. In order words, I'd like to run http://localhost:8080/index.jsp and have that be a different site (using a different directory) than http://localhost:9800/index.jsp It's easier to do name-based virtual hosts. But if extra work appeals to you :-) create multiple Service elements, each with appropriate Connector and Host entries. FWIW! -- Hassan Schroeder [EMAIL PROTECTED] - 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: Multiple development sites using different ports
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 dylanmac, dylanmac wrote: | The reason this matters to me is because I like running my sites as | root-relative. That way I can reference images, files, etc as, for example, | /images/logo.png rather than having to traverse the directory structure via | ../. This makes the site much more portable and accurately reflects how | the site will run in production anyway (where most sites run as root). You would be better off using paths that are relative to the context root. There are many tools that will do this form you in JSPs or whatever template language you may be using to generate content. | So can anyone give me a quick primer on how to configure Tomcat to use | multiple ports for root-relative development? I have spent several hours | researching this with no luck. Check out the RUNNING.txt file that ships with Tomcat. Read the Advanced Configuration - Multiple Tomcat Instances section; it should help a lot. The only thing you have to remember to do is to set the ports for each instance's Connector elements and make sure you don't get confused. I have this exact same setup in dev, test, demo, and prod (with the addition of Apache httpd and mod_jk, too), so I should be able to answer any questions you have. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkhkBb8ACgkQ9CaO5/Lv0PC7QgCdFxw0UsIe3DIsy/9wSkiQkMA9 7XQAniBUkf/xsh/P0XUGf9MdJV+aBDzD =VH3v -END PGP SIGNATURE- - 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: Multiple development sites using different ports
Thanks for your response. Unfortunately I am pretty green about all this and it doesn't make a lot of sense to me. When you say better off using paths that are relative to the context root do you mean I shouldn't be using root-relative? What tools are available that will help me do this in the JSP (I am not using a templating system; these are just prototype sites I am building - not complicated). I read the advanced configuration section of running.txt and the connector part seemss straightofward but then it seems to require startup variables at the command line. I have Tomcat running as a service so setting it to run with a different $CATALINA_BASE is not obvious. Thanks. Christopher Schultz-2 wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 dylanmac, dylanmac wrote: | The reason this matters to me is because I like running my sites as | root-relative. That way I can reference images, files, etc as, for example, | /images/logo.png rather than having to traverse the directory structure via | ../. This makes the site much more portable and accurately reflects how | the site will run in production anyway (where most sites run as root). You would be better off using paths that are relative to the context root. There are many tools that will do this form you in JSPs or whatever template language you may be using to generate content. | So can anyone give me a quick primer on how to configure Tomcat to use | multiple ports for root-relative development? I have spent several hours | researching this with no luck. Check out the RUNNING.txt file that ships with Tomcat. Read the Advanced Configuration - Multiple Tomcat Instances section; it should help a lot. The only thing you have to remember to do is to set the ports for each instance's Connector elements and make sure you don't get confused. I have this exact same setup in dev, test, demo, and prod (with the addition of Apache httpd and mod_jk, too), so I should be able to answer any questions you have. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkhkBb8ACgkQ9CaO5/Lv0PC7QgCdFxw0UsIe3DIsy/9wSkiQkMA9 7XQAniBUkf/xsh/P0XUGf9MdJV+aBDzD =VH3v -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Multiple-development-sites-using-different-ports-tp18139932p18145739.html Sent from the Tomcat - User mailing list archive at Nabble.com. - 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: Multiple development sites using different ports
I looked at name-based virtual hosts and couldn't get it working. Moreover all of the documentation says I need to configure the DNS properly for name-based virtual hosting to work. Where do I do that? Thanks. Hassan Schroeder-2 wrote: On Thu, Jun 26, 2008 at 11:08 AM, dylanmac [EMAIL PROTECTED] wrote: I'd like to configure Tomcat so that I can run multiple dev websites as root relative and distinguish them via port numbers. In order words, I'd like to run http://localhost:8080/index.jsp and have that be a different site (using a different directory) than http://localhost:9800/index.jsp It's easier to do name-based virtual hosts. But if extra work appeals to you :-) create multiple Service elements, each with appropriate Connector and Host entries. FWIW! -- Hassan Schroeder [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/Multiple-development-sites-using-different-ports-tp18139932p18145753.html Sent from the Tomcat - User mailing list archive at Nabble.com. - 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: Multiple development sites using different ports
On Thu, Jun 26, 2008 at 4:58 PM, dylanmac [EMAIL PROTECTED] wrote: I looked at name-based virtual hosts and couldn't get it working. Moreover all of the documentation says I need to configure the DNS properly for name-based virtual hosting to work. Where do I do that? If this is only for your own use -- as I surmise from your examples of http://localhost:/ -- you don't need DNS. Just put the names in your /etc/hosts file (or equivalent). I always do multiple dev sites this way. It's dead simple. -- Hassan Schroeder [EMAIL PROTECTED] - 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: Multiple development sites using different ports
From: dylanmac [mailto:[EMAIL PROTECTED] Subject: Re: Multiple development sites using different ports I looked at name-based virtual hosts and couldn't get it working. What did you try and what didn't work? Be specific. Did you read the doc: http://tomcat.apache.org/tomcat-6.0-doc/virtual-hosting-howto.html I need to configure the DNS properly for name-based virtual hosting to work. Only if you're going to expose your web sites to an uncontrolled set of clients (e.g., the Internet). Otherwise, as Hassan noted, simply update the /etc/hosts file on each client computer to include all the host names you want, all targeting the same IP address. (For Windows clients, it's in C:\WINDOWS\system32\drivers\etc\hosts.) - 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]