RE: 2 VirtualHosts same IP address and port on Tomcat not working
Hi, I have read dozens of archived posts on virtualhost. I have distilled my httpd.conf and server.xml back to what seems to be the recommended approach, see below. But now I can see no sites on any URL. I have a suspicous End event threw exception in the catalina.out log, which suggests a problem with server.xml, but reading it I cannot see any illegal XML, so assume it is a configuration value error. At the end of the exception it also has ...IllegalArguementException: Servlet mapping specifies an unknown servlet name rwsite which suggests it doesn't like my second Host configuration. But I copied and pasted it from a posted version that worked and just changed the appBase and servername to appropriate values? In my error_log I get 2 types of errors: 1. Directory Index forbidden by rule: /usr/local/jakarta-tomcat-4.1.12/webapp1/rwsite - there is that same troublesome rwsite again. 2. File does not exist: /usr/local/jakarta-tomcat-4.1.12/webapp1/rwsite/servlet it's not a file but a directory? and I get File does not exist: /usr/local/jakarta-tomcat-4.1.12/webapp2/se/servlet, referer: http://www.stpenable.com/se/servlet/se/template/solutions%2Cmdmanage.vm; which is real. server.xml hosts section-- !-- Define the default virtual host -- Host name=www.stpenable.com debug=0 appBase=/usr/local/jakarta-tomcat-4.1.12/webapp2 unpackWARs=true autoDeploy=true Aliaslocalhost/Alias Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=stpenable_access_log. suffix=.txt pattern=common/ Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=stpenable_log. suffix=.txt timestamp=true/ Context path= docBase=/usr/local/jakarta-tomcat-4.1.12/webapp2/se debug=1/ Context path=/rwtransform docBase=/usr/local/jakarta-tomcat-4.1.12/webapp2/rwtransform debug=1/ /Host Host name=www.roamware.co.uk debug=0 appBase=/usr/local/jakarta-tomcat-4.1.12/webapp1 unpackWARs=true autoDeploy=true Context path= docBase= debug=1/ Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=roamware_access_log. suffix=.txt pattern=common resolveHosts=false/ /Host httpd.conf section-- NameVirtualHost * # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # JkWorkersFile /usr/local/tomcat/conf/jk/workers.properties JkLogFile /usr/local/tomcat/logs/mod_jk.log JkLogLevel debug VirtualHost * ServerName www.stpenable.com www.stpenable.com:/se ServerAlias localhost # Static files DocumentRoot /usr/local/jakarta-tomcat-4.1.12/webapp2/se Alias /se /usr/local/jakarta-tomcat-4.1.12/webapp2/se Location /se/WEB-INF/* AllowOverride None deny from all /Location Location /se/META-INF/* AllowOverride None deny from all /Location JkMount /usr/local/jakarta-tomcat-4.1.12/webapp2/se/* ajp13 www.stpenable.com:/rwtransform Alias /rwsite /usr/local/jakarta-tomcat-4.1.12/webapp2/rwtransform Location /rwtransform/WEB-INF/* AllowOverride None deny from all /Location Location /rwtransform/META-INF/* AllowOverride None deny from all /Location JkMount /usr/local/jakarta-tomcat-4.1.12/webapp2/rwtransform/* ajp13 /VirtualHost VirtualHost * ServerName www.roamware.co.uk www.roamware.co.uk:/rwsite # Static files DocumentRoot /usr/local/jakarta-tomcat-4.1.12/webapp1/rwsite Alias /rwsite /usr/local/jakarta-tomcat-4.1.12/webapp1/rwsite Location /rwsite/WEB-INF/* AllowOverride None deny from all /Location Location /rwsite/META-INF/* AllowOverride None deny from all /Location JkMount /usr/local/jakarta-tomcat-4.1.12/webapp1/rwsite/* ajp13 /VirtualHost I think I have tried everything I can with this. Any further suggestions? Seems like John Turner is the only one able to answer these questions. Regards David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 2 VirtualHosts same IP address and port on Tomcat not working
David Wynter wrote: Hi, It seems that the second VirtualHost I have set up for my second domain name is not paasing the requests through mod_jk to Tomcat. It is not even clear that you can support 2 virtualhosts for different domains with the same IP address and port 80. This is a separate problem to the www.stpenable.com not redirecting to www.stpenable.com/se/servlet/se/templates/index.vm but it still affects me. You can support many virtual hosts on the same IP address. I have production environments with 6, 9, and 12 virtual hosts working just fine. Is the only way I can support a second virtual host is by setting up a second Service with its own Engine and Ajp13 connector listening on a separate port (say 8007 instead of 8009?). I assume I then setup a second worker on the port I have introduced. And in this case do both sevices also have a listener for port 8080, or do I need one on that port at all since all my trafic will be on port 80? No, this is incorrect. You only need one Service. Your problems are related to your httpd.conf file, not the connector and not Tomcat. You have to instruct Apache appropriately. Its more than just JkMount, you also have to get your Alias and your DocumentRoot directives correct in httpd.conf...getting them wrong will cause Apache to miss the mod_jk match. I just tried it without a listener on port 8080, and a service with a connector on 8007 for one virtual host and a separate service with connector on 8009 for the other, nothing worked, so I suppose that answers my question. I am kinda surprised that on the whole internet there is not a configuration example of running different webapps on 2 domains on the same Tomcat instance, there must be hundreds of people doing it? There are. I've posted an example to this list twice in the past 4 months or so. John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 2 VirtualHosts same IP address and port on Tomcat not working
Advice: Forget about servlets. Forget about serving all content from a servlet. Too many variables, causing you too much confusion. Take it one step at a time. First: set up Tomcat so that you have 2 virtual hosts. Each virtual host needs a SEPARATE appBase. If BOTH virtual hosts are to be IDENTICAL, then DON'T use a separate Host node for the second one (or a separate appBase), instead set up one Host node and use the Alias directive in server.xml to alias the second hostname to the first. Second: Create your Contexts. Root, subdir, whatever, set it up as you plan to use them in your URLs. Third: Create a SIMPLE JSP, like hello world or whatever. Put that in the appropriate Context. Stop Tomcat. Delete EVERYTHING in the work directory (but not the work directory itself). Start Tomcat. Fourth: Verify that http://host1:8080/yourContext1/yourSimple.jsp works as expected. Fifth: Verify that http://host2:8080/yourContext2/yourSimple.jsp works as expected. Then, and only then, worry about Apache. If you get to this step, then you know Tomcat is OK and your problems are Apache related. Right now you are fudging with both ends of the equation, and being wrong in either or both can make the whole thing fall apart with zero indication of which end is causing the problem. Sixth: create a VirtualHost in httpd.conf. Set the DocumentRoot to be equal to the Context in server.xml. Thus, everything you do from that point on in your app has to be relative to the webapp root and URLs for static and dynamic content will be the same. Seventh: Setup your JkMount. If your DocumentRoot is set correctly, and your Contexts are set correctly, you should be able to get what you want with: JkMount /*.jsp ajp13 JkMount /servlet/* ajp13 assuming your servlets are in /servlet. You might also want to consider putting an extension on your servlets, as in Struts, like *.do or something. This makes JkMount even easier. This is only for testing. Once you have it working, and you want to generate everything with a servlet, then change your JkMount to /*. John David Wynter wrote: Hi, I have read dozens of archived posts on virtualhost. I have distilled my httpd.conf and server.xml back to what seems to be the recommended approach, see below. But now I can see no sites on any URL. I have a suspicous End event threw exception in the catalina.out log, which suggests a problem with server.xml, but reading it I cannot see any illegal XML, so assume it is a configuration value error. At the end of the exception it also has ...IllegalArguementException: Servlet mapping specifies an unknown servlet name rwsite which suggests it doesn't like my second Host configuration. But I copied and pasted it from a posted version that worked and just changed the appBase and servername to appropriate values? In my error_log I get 2 types of errors: 1. Directory Index forbidden by rule: /usr/local/jakarta-tomcat-4.1.12/webapp1/rwsite - there is that same troublesome rwsite again. 2. File does not exist: /usr/local/jakarta-tomcat-4.1.12/webapp1/rwsite/servlet it's not a file but a directory? and I get File does not exist: /usr/local/jakarta-tomcat-4.1.12/webapp2/se/servlet, referer: http://www.stpenable.com/se/servlet/se/template/solutions%2Cmdmanage.vm; which is real. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 2 VirtualHosts same IP address and port on Tomcat not working
For grins, I decided to setup an example. Here it is. The server has multiple virtual hosts. There are currently 6 working, this configuration describes how I added a seventh by copying a config from one of the other 6 and changing values as needed. The scenario: One Tomcat instance (4.1.12, yes I know its old but its an internal play server so not that important) Multi-virtual hosts, each one has its own appBase ($CATALINA_HOME/hostname). Each virtual host has a root context ($CATALINA_HOME/hostname/hostname). Apache 2, mod_jk.so. The goal: http://hostname/test.jsp works http://hostname/test.html works To setup the new virtual host, I did the following: - in server.xml, added: Host name=www.DOMAIN.com debug=1 appBase=DOMAIN unpackWARs=true autoDeploy=true Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=DOMAIN_com. suffix=.log timestamp=true/ Context path= docBase=DOMAIN debug=0 reloadable=true Logger className=org.apache.catalina.logger.FileLogger prefix=DOMAIN. suffix=.log timestamp=true / Resource name=mail/Session auth=Container type=javax.mail.Session/ ResourceParams name=mail/Session parameter namemail.smtp.host/name valuelocalhost/value /parameter /ResourceParams /Context /Host - created $CATALINA_HOME/DOMAIN, $CATALINA_HOME/DOMAIN/DOMAIN, $CATALINA_HOME/DOMAIN/DOMAIN/WEB-INF, $CATALINA_HOME/DOMAIN/DOMAIN/WEB-INF/classes, $CATALINA_HOME/DOMAIN/DOMAIN/WEB-INF/lib, $CATALINA_HOME/DOMAIN/DOMAIN/WEB-INF/web.xml where $CATALINA_HOME = /usr/local/jakarta-tomcat-4.1.12 - chown -R tomcat:tomcat $CATALINA_HOME/DOMAIN - created $CATALINA_HOME/DOMAIN/DOMAIN/test.html and $CATALINA_HOME/DOMAIN/DOMAIN/test.jsp in Apache httpd.conf, added: VirtualHost * ServerName www.DOMAIN.com DocumentRoot /usr/local/jakarta-tomcat-4.1.12/DOMAIN/DOMAIN # Static files Alias / /usr/local/jakarta-tomcat-4.1.12/DOMAIN/DOMAIN Directory /usr/local/jakarta-tomcat-4.1.12/DOMAIN/DOMAIN Options Indexes FollowSymLinks DirectoryIndex index.jsp /Directory # Deny direct access to WEB-INF and META-INF # Location /WEB-INF/* AllowOverride None deny from all /Location Location /META-INF/* AllowOverride None deny from all /Location JkMount /* ajp13 /VirtualHost - stopped Tomcat. stopped Apache. Removed contents of $CATALINA_HOME/work/Standalone. Started Tomcat. Started Apache. - verified that http://www.DOMAIN.com/test.jsp and http://www.DOMAIN.com/test.html work, and that http://www.DOMAIN.com/WEB-INF/web.xml returns a 403. Wherever you see DOMAIN in the above, substitute the domain name that you want to use, or anything else, as long as you stay consistent. I decided to use a JkMount of /* only because that's what you said you wanted to do by having a servlet generate all content...I could have just as easily made the JkMount be /*.jsp or whatever. Your servlets now go in $CATALINA_HOME/DOMAIN/DOMAIN/WEB-INF, and you can adjust your web.xml appropriately to map them to a URL starting with / as in http://www.DOMAIN.com/SERVLET-URL. Thus, things like /WEB-INF in the Location directive are RELATIVE to things like Alias, as is JkMount..if you get Alias wrong (and/or DocumentRoot) you're going to have lots of problems, and messing with your Contexts in server.xml or putting strange onLoad Javascript redirects in your pages isn't going to make it any better. I'm not sure how much clearer I can be than the above, but I am always open to suggestions/corrections. HTH John David Wynter wrote: Hi, It seems that the second VirtualHost I have set up for my second domain name is not paasing the requests through mod_jk to Tomcat. It is not even clear that you can support 2 virtualhosts for different domains with the same IP address and port 80. This is a separate problem to the www.stpenable.com not redirecting to www.stpenable.com/se/servlet/se/templates/index.vm but it still affects me. Is the only way I can support a second virtual host is by setting up a second Service with its own Engine and Ajp13 connector listening on a separate port (say 8007 instead of 8009?). I assume I then setup a second worker on the port I have introduced. And in this case do both sevices also have a listener for port 8080, or do I need one on that port at all since all my trafic will be on port 80? I just tried it without a listener on port 8080, and a service with a connector on 8007 for one virtual host and a separate service with connector on 8009 for the other, nothing worked, so I suppose that answers my question. I am kinda surprised that on the whole internet there is not a configuration example of running different webapps on 2 domains on the same Tomcat instance, there must be hundreds of people doing it? Thanks David -Original
2 VirtualHosts same IP address and port on Tomcat not working
Hi,. I have read John Turner HowTo and the Galatea ones too. I have tried multiple different combinations of these. I found John's assetion that Tomcat does not generate multi VirtualHosts, but you can take the generated one, insert at the bottom of the httpd.conf and modify it to work. I know mod_jk works as I used it with a single host until I need it have to domains. I have tried the approach suggested by John but so far all I get is a directory listing of the resolved directory. I am using Turbine as the servlet processor, it uses .vm extension not .jsp. Here is my workers.properties and bottom of my httpd.conf. Can anyone see what is wrong. The server is up so try the URLs if you want to. I can put in the full servlet path eg. www.stpenable.com/se/servlet/se/templates/index.vm and it works. But it does not resolve from www.stpenable.com as it should. worker.properties- # BEGIN workers.properties worker.list=ajp13, worker1 worker.ajp13.port=8009 # change this line to match apache ServerName and Host name in server.xml worker.ajp13.host=www.stpenable.com worker.ajp13.type=ajp13 worker.worker1.port=8009 # change this line to match apache ServerName and Host name in server.xml worker.worker1.host=www.roamware.co.uk worker.worker1.type=ajp13 # END workers.properties excerpt from bottom of http.conf, and yes it does have mod_jk.so loaded-- NameVirtualHost * JkWorkersFile /usr/local/tomcat/conf/jk/workers.properties JkLogFile /usr/local/tomcat/logs/mod_jk.log JkLogLevel debug VirtualHost * ServerName www.stpenable.com www.stpenable.com:/se # Static files Alias /se /usr/local/tomcat/webapp2/se Directory /usr/local/tomcat/webapp2/se Options Indexes FollowSymLinks DirectoryIndex index.html index.htm index.vm /Directory # Deny direct access to WEB-INF and META-INF # Location /se/WEB-INF/* AllowOverride None deny from all /Location Location /se/META-INF/* AllowOverride None deny from all /Location JkMount /se/*.shtml ajp13 JkMount /se/cgi-bin/* ajp13 JkMount /se/servlet/* ajp13 JkMount /se/*.vm ajp13 www.stpenable.com:/rwtransform # Static files Alias /rwtransform /usr/local/tomcat/webapp2/rwtransform Directory /usr/local/tomcat/webapp2/rwtransform Options Indexes FollowSymLinks DirectoryIndex index.html index.htm index.vm /Directory # Deny direct access to WEB-INF and META-INF # Location /rwtransform/WEB-INF/* AllowOverride None deny from all /Location Location /rwtransform/META-INF/* AllowOverride None deny from all /Location JkMount /rwtransform/*.shtml ajp13 JkMount /rwtransform/cgi-bin/* ajp13 JkMount /rwtransform/servlet/* ajp13 JkMount /rwtransform/*.vm ajp13 /VirtualHost VirtualHost * ServerName www.roamware.co.uk www.roamware.co.uk:/rwsite # Static files Alias /rwsite /usr/local/tomcat/webapp1/rwsite Directory /usr/local/tomcat/webapp1/rwsite Options Indexes FollowSymLinks DirectoryIndex index.html index.htm index.vm /Directory # Deny direct access to WEB-INF and META-INF # Location /rwsite/WEB-INF/* AllowOverride None deny from all /Location Location /rwsite/META-INF/* AllowOverride None deny from all /Location JkMount /rwsite/servlet/* worker1 JkMount /rwsite/*.vm worker1 /VirtualHost David Wynter roamware Ltd. (+44) (0) 208 922 7539 B. (+44) (0) 7879 605 706 M. www.roamware.co.uk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 2 VirtualHosts same IP address and port on Tomcat not working
I think there's some confusion...you only need this in workers.properties: # BEGIN workers.properties worker.list=ajp13 worker.ajp13.port=8009 worker.ajp13.host=localhost worker.ajp13.type=ajp13 .host = location of Tomcat When I first started trying to connect Tomcat and Apache a year ago, I thought I needed an entry for each virtual host in workers.properties. I have since learned that this is not true. Workers.properties only defines where do I find Tomcat not which virtual hosts will Tomcat accept. The latter is determined by server.xml. When I go to http://www.stpenable.com and http://www.stpenable.com/se/ I get a directory listing. What is it that I am supposed to get? You have *.shtml assigned to Tomcat. Why? Do you have .shtml as a servlet mapping in web.xml or something? I don't think your issues are virtual host related...perhaps if you could clarify what it is you want to do, we can help. John David Wynter wrote: Hi,. I have read John Turner HowTo and the Galatea ones too. I have tried multiple different combinations of these. I found John's assetion that Tomcat does not generate multi VirtualHosts, but you can take the generated one, insert at the bottom of the httpd.conf and modify it to work. I know mod_jk works as I used it with a single host until I need it have to domains. I have tried the approach suggested by John but so far all I get is a directory listing of the resolved directory. I am using Turbine as the servlet processor, it uses .vm extension not .jsp. Here is my workers.properties and bottom of my httpd.conf. Can anyone see what is wrong. The server is up so try the URLs if you want to. I can put in the full servlet path eg. www.stpenable.com/se/servlet/se/templates/index.vm and it works. But it does not resolve from www.stpenable.com as it should. worker.properties- # BEGIN workers.properties worker.list=ajp13, worker1 worker.ajp13.port=8009 # change this line to match apache ServerName and Host name in server.xml worker.ajp13.host=www.stpenable.com worker.ajp13.type=ajp13 worker.worker1.port=8009 # change this line to match apache ServerName and Host name in server.xml worker.worker1.host=www.roamware.co.uk worker.worker1.type=ajp13 # END workers.properties excerpt from bottom of http.conf, and yes it does have mod_jk.so loaded-- NameVirtualHost * JkWorkersFile /usr/local/tomcat/conf/jk/workers.properties JkLogFile /usr/local/tomcat/logs/mod_jk.log JkLogLevel debug VirtualHost * ServerName www.stpenable.com www.stpenable.com:/se # Static files Alias /se /usr/local/tomcat/webapp2/se Directory /usr/local/tomcat/webapp2/se Options Indexes FollowSymLinks DirectoryIndex index.html index.htm index.vm /Directory # Deny direct access to WEB-INF and META-INF # Location /se/WEB-INF/* AllowOverride None deny from all /Location Location /se/META-INF/* AllowOverride None deny from all /Location JkMount /se/*.shtml ajp13 JkMount /se/cgi-bin/* ajp13 JkMount /se/servlet/* ajp13 JkMount /se/*.vm ajp13 www.stpenable.com:/rwtransform # Static files Alias /rwtransform /usr/local/tomcat/webapp2/rwtransform Directory /usr/local/tomcat/webapp2/rwtransform Options Indexes FollowSymLinks DirectoryIndex index.html index.htm index.vm /Directory # Deny direct access to WEB-INF and META-INF # Location /rwtransform/WEB-INF/* AllowOverride None deny from all /Location Location /rwtransform/META-INF/* AllowOverride None deny from all /Location JkMount /rwtransform/*.shtml ajp13 JkMount /rwtransform/cgi-bin/* ajp13 JkMount /rwtransform/servlet/* ajp13 JkMount /rwtransform/*.vm ajp13 /VirtualHost VirtualHost * ServerName www.roamware.co.uk www.roamware.co.uk:/rwsite # Static files Alias /rwsite /usr/local/tomcat/webapp1/rwsite Directory /usr/local/tomcat/webapp1/rwsite Options Indexes FollowSymLinks DirectoryIndex index.html index.htm index.vm /Directory # Deny direct access to WEB-INF and META-INF # Location /rwsite/WEB-INF/* AllowOverride None deny from all /Location Location /rwsite/META-INF/* AllowOverride None deny from all /Location JkMount /rwsite/servlet/* worker1 JkMount /rwsite/*.vm worker1 /VirtualHost David Wynter roamware Ltd. (+44) (0) 208 922 7539 B. (+44) (0) 7879 605 706 M. www.roamware.co.uk - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional
RE: 2 VirtualHosts same IP address and port on Tomcat not working
Hi John, Thanks for the reply. I have fixed the workers.properties and related stuff in the httpd.conf you pointed out below. What I want is to see what i see at www.stpenable.com/se/servlet/se/templates/index.vm to be what I see when I hit www.stpenable.com Ditto for www.roamware.co.uk to see www.roamware.co.uk/rwsite/servlet/rwsite/templates/index.vm. These servlet contexts have just become visible because I removed all the Context entries in the various Host... sections of my server.xml. thanks David -Original Message- From: John Turner [mailto:[EMAIL PROTECTED] Sent: 21 August 2003 14:59 To: Tomcat Users List Subject: Re: 2 VirtualHosts same IP address and port on Tomcat not working I think there's some confusion...you only need this in workers.properties: # BEGIN workers.properties worker.list=ajp13 worker.ajp13.port=8009 worker.ajp13.host=localhost worker.ajp13.type=ajp13 .host = location of Tomcat When I first started trying to connect Tomcat and Apache a year ago, I thought I needed an entry for each virtual host in workers.properties. I have since learned that this is not true. Workers.properties only defines where do I find Tomcat not which virtual hosts will Tomcat accept. The latter is determined by server.xml. When I go to http://www.stpenable.com and http://www.stpenable.com/se/ I get a directory listing. What is it that I am supposed to get? You have *.shtml assigned to Tomcat. Why? Do you have .shtml as a servlet mapping in web.xml or something? I don't think your issues are virtual host related...perhaps if you could clarify what it is you want to do, we can help. John - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: 2 VirtualHosts same IP address and port on Tomcat not working
Actually I should qualify what I said. I have stpenable as the default Host so you can see www.stpenable.com/se/servlet/se/templates/index.vm but for some reason you cannot see www.roamware.co.uk/rwsite/servlet/rwsite/templates/index.vm which is the second of the VirtualHosts in my conf file. They are configured as matching patterns (if you know what I mean - only the names have changed between the 2 configs). The DefualHost in the Engine is www.stpenable.com Here is the Host section from my server.xml, I've strpped out the comments- !-- Define the default virtual host -- Host name=localhost debug=0 appBase=webapps unpackWARs=true autoDeploy=true Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=localhost_log. suffix=.txt timestamp=true/ /Host !-- Define the default virtual host -- Host name=www.stpenable.com debug=0 appBase=webapp2 unpackWARs=true autoDeploy=true Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=stpenable_access_log. suffix=.txt pattern=common/ Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=stpenable_log. suffix=.txt timestamp=true/ /Host !-- Define the default virtual host -- Host name=www.roamware.co.uk debug=0 appBase=webapp1 unpackWARs=true autoDeploy=true Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=stpenable_access_log. suffix=.txt pattern=common/ Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=roamware_log. suffix=.txt timestamp=true/ /Host regards, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: 2 VirtualHosts same IP address and port on Tomcat not working
Did you remove the Context entries for some reason? They are critical. Also, in httpd.conf you have: # Static files Alias /rwsite /usr/local/tomcat/webapp1/rwsite and later JkMount /rwsite/servlet/* worker1 JkMount /rwsite/*.vm worker1 Thus, the URLs that Apache would expect would be: www.roamware.co.uk/rwsite/rwsite/servlet/rwsite/templates/index.vm Aside from the three rwsite entries this looks pretty convoluted to me. If you have /rwsite in an Alias in httpd.conf, then your JkMount would be, AFAIK: JkMount /servlet/* worker1 JkMount /*.vm worker1 John David Wynter wrote: Actually I should qualify what I said. I have stpenable as the default Host so you can see www.stpenable.com/se/servlet/se/templates/index.vm but for some reason you cannot see www.roamware.co.uk/rwsite/servlet/rwsite/templates/index.vm which is the second of the VirtualHosts in my conf file. They are configured as matching patterns (if you know what I mean - only the names have changed between the 2 configs). The DefualHost in the Engine is www.stpenable.com Here is the Host section from my server.xml, I've strpped out the comments- !-- Define the default virtual host -- Host name=localhost debug=0 appBase=webapps unpackWARs=true autoDeploy=true Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=localhost_log. suffix=.txt timestamp=true/ /Host !-- Define the default virtual host -- Host name=www.stpenable.com debug=0 appBase=webapp2 unpackWARs=true autoDeploy=true Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=stpenable_access_log. suffix=.txt pattern=common/ Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=stpenable_log. suffix=.txt timestamp=true/ /Host !-- Define the default virtual host -- Host name=www.roamware.co.uk debug=0 appBase=webapp1 unpackWARs=true autoDeploy=true Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=stpenable_access_log. suffix=.txt pattern=common/ Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=roamware_log. suffix=.txt timestamp=true/ /Host regards, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: 2 VirtualHosts same IP address and port on Tomcat not working
Hi, It seems that the second VirtualHost I have set up for my second domain name is not paasing the requests through mod_jk to Tomcat. It is not even clear that you can support 2 virtualhosts for different domains with the same IP address and port 80. This is a separate problem to the www.stpenable.com not redirecting to www.stpenable.com/se/servlet/se/templates/index.vm but it still affects me. Is the only way I can support a second virtual host is by setting up a second Service with its own Engine and Ajp13 connector listening on a separate port (say 8007 instead of 8009?). I assume I then setup a second worker on the port I have introduced. And in this case do both sevices also have a listener for port 8080, or do I need one on that port at all since all my trafic will be on port 80? I just tried it without a listener on port 8080, and a service with a connector on 8007 for one virtual host and a separate service with connector on 8009 for the other, nothing worked, so I suppose that answers my question. I am kinda surprised that on the whole internet there is not a configuration example of running different webapps on 2 domains on the same Tomcat instance, there must be hundreds of people doing it? Thanks David -Original Message- From: David Wynter [mailto:[EMAIL PROTECTED] Sent: 21 August 2003 15:39 To: Tomcat Users List Subject: RE: 2 VirtualHosts same IP address and port on Tomcat not working Actually I should qualify what I said. I have stpenable as the default Host so you can see www.stpenable.com/se/servlet/se/templates/index.vm but for some reason you cannot see www.roamware.co.uk/rwsite/servlet/rwsite/templates/index.vm which is the second of the VirtualHosts in my conf file. They are configured as matching patterns (if you know what I mean - only the names have changed between the 2 configs). The DefualHost in the Engine is www.stpenable.com Here is the Host section from my server.xml, I've strpped out the comments- !-- Define the default virtual host -- Host name=localhost debug=0 appBase=webapps unpackWARs=true autoDeploy=true Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=localhost_log. suffix=.txt timestamp=true/ /Host !-- Define the default virtual host -- Host name=www.stpenable.com debug=0 appBase=webapp2 unpackWARs=true autoDeploy=true Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=stpenable_access_log. suffix=.txt pattern=common/ Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=stpenable_log. suffix=.txt timestamp=true/ /Host !-- Define the default virtual host -- Host name=www.roamware.co.uk debug=0 appBase=webapp1 unpackWARs=true autoDeploy=true Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=stpenable_access_log. suffix=.txt pattern=common/ Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=roamware_log. suffix=.txt timestamp=true/ /Host regards, David - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: 2 VirtualHosts same IP address and port on Tomcat not working
Hi John, Thanks for the pointers. I found a good tutorial on vhosts but using jk2 in the Tomcat 4.1 docs. So it helped a little. I have change to using DocumentRoot, less confusing. I also tried full paths instead of relative. I had removed the Context entries because it meant I could at least type in the full servlet URL and see the site, with the ones I had (which must have been wrong) I couldn't. Anyway I am at the stage where using the example files I am forbidden (403) from seeing www.stpenable.com or www.roamware.co.uk I think because of the Directory / entry. But I can see the /se servlet with the full URL but not rwtransform or rwsite webapps. Here is the bottom of my httpd.conf. I think i need to change the overall DocumentRoot to /usr/local/jakarta-tomcat-4.1.12/webapp2/ , this directive is easy to understand in the context of serving up static pages, but not where all content is dynamically served by a servlet? I also think I need to get rid of the Directory / entry and I might get further along. DocumentRoot /usr/local/jakarta-tomcat-4.1.12/webapp2/se Directory /usr/local/jakarta-tomcat-4.1.12/webapp2/se Options None AllowOverride None /Directory DirectoryIndex index.html index.vm Directory / Options None AllowOverride None /Directory Files ~ ^\.ht Order allow,deny Deny from all /Files Location /WEB-INF/ Order Allow,Deny /Location Location /META-INF/ Order Allow,Deny /Location NameVirtualHost * # # VirtualHost example: # Almost any Apache directive may go into a VirtualHost container. # The first VirtualHost section is used for requests without a known # server name. # JkWorkersFile /usr/local/tomcat/conf/jk/workers.properties JkLogFile /usr/local/tomcat/logs/mod_jk.log JkLogLevel debug VirtualHost * ServerName www.stpenable.com www.stpenable.com:/se ServerAlias localhost # Static files DocumentRoot /usr/local/jakarta-tomcat-4.1.12/webapp2 JkMount /se/servlet/* ajp13 JkMount /se/*.vm ajp13 www.stpenable.com:/rwtransform #JkMount /rwtransform/servlet/* ajp13 #JkMount /rwtransform/*.vm ajp13 /VirtualHost VirtualHost * ServerName www.roamware.co.uk www.roamware.co.uk:/rwsite # Static files DocumentRoot /usr/local/jakarta-tomcat-4.1.12/webapp1/rwsite JkMount /servlet/* ajp13 JkMount /*.vm ajp13 /VirtualHost Now my Hosts section of the Server.xml-- !-- Define the default virtual host -- Host name=www.stpenable.com debug=0 appBase=/usr/local/jakarta-tomcat-4.1.12/webapp2 unpackWARs=true autoDeploy=true Aliaslocalhost/Alias !-- Access log processes all requests for this virtual host. By default, log files are created in the logs directory relative to $CATALINA_HOME. If you wish, you can specify a different directory with the directory attribute. Specify either a relative (to $CATALINA_HOME) or absolute path to the desired directory. -- Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=stpenable_access_log. suffix=.txt pattern=common/ !-- Logger shared by all Contexts related to this virtual host. By default (when using FileLogger), log files are created in the logs directory relative to $CATALINA_HOME. If you wish, you can specify a different directory with the directory attribute. Specify either a relative (to $CATALINA_HOME) or absolute path to the desired directory.-- Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=stpenable_log. suffix=.txt timestamp=true/ Context path= docBase=/usr/local/jakarta-tomcat-4.1.12/webapp2/se debug=1/ Context path=/rwtransform docBase=/usr/local/jakarta-tomcat-4.1.12/webapp2/rwtransform debug=1/ /Host !-- Define the default virtual host -- Host name=www.roamware.co.uk debug=0 appBase=/usr/local/jakarta-tomcat-4.1.12/webapp1 unpackWARs=true autoDeploy=true !-- Access log processes all requests for this virtual host. By default, log files are created in the logs directory relative to $CATALINA_HOME. If you wish, you can specify a different directory with the directory attribute. Specify either a relative (to $CATALINA_HOME) or absolute path to the desired directory. -- Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=stpenable_access_log. suffix=.txt pattern=common/ !-- Logger shared by all Contexts related to this virtual host. By default (when using