Re: Apache Accessing Tomcat Issue
On 30.03.2013 21:53, Chris Arnold wrote: See above and ended up having to comment this out as it is not supported in the version of mod_jk i am using. Apache finally started after commenting those out and changing the port. And i can now access http://share.domain.com Ranier, thank you for your time and instruction. Shall i send you some paypal monies? No, thanks for the offer. Have fun! Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Apache Accessing Tomcat Issue
On 29.03.2013 18:02, Chris Arnold wrote: http://share.domain.com and get the required results (which is http://share.domain.com/share) Let's stick to mod_jk for the moment. I think you are close. OK Here is the modified virtualhost file: VirtualHost *:80 ServerName share.domain.com #RewriteEngine On #RewriteCond %{REQUEST_URI} !^/share/ #RewriteCond %{HTTPS} on #RewriteRule ^/. http://share.domain.com/share/ [P] JkMount /share|/* worker1 RedirectMatch ^/$ http://share.domain.com/share/ ErrorLog /var/log/apache2/domain.com-error_log CustomLog /var/log/apache2/domain.com-access_log combined /VirtualHost OK, one thing I forgot, sorry: this config uses a load balancer worker which even if there's only one Tomcat instance involved allows a bit more of control. For this to work you need to replace the name worker1 in the above JkMount with balancer: JkMount /share|/* balancer because that's the name of the load balancer worker in your workers.properties. If you don't want to use the balancer, then add to workers.properties the line worker.list=worker1 and optionally remove all lines that start with worker.balancer and the line worker.list=balancer But you can also keep them if you later want to test the load balancer worker. Here is the new workers.properties file: .. # the final value for y will be value\something # Define two status worker: # - jk-status for read-only use # - jk-manager for read/write use worker.list=jk-status worker.list=jk-status.type=status worker.jk-status.read_only=true worker.list=jk-manager worker.list=worker1 worker.jk-manager.type=status Not that good, but probably will work nevertheless ;) Give it a try (with! I dont understand the With! part. Is that part of the apache restart command to force? If it doesn't work, increase the JkLogLevel to debug and post the JK log file contents (and the Apache error log and access log entries for your test requests). Well, now apache does not start. Gives this error: error in reading worker properties from /opt/path to/worker.properties Configuration failed Seems it doesn't like something about the worker.properties file. Due to that i will post the complete workers.properties file (it is writeable): # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the License); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an AS IS BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Note that the distributed version of this file requires modification # before it is usable. # # Reference documentation: http://tomcat.apache.org/connectors-doc/reference/workers.html # # As a general note, the characters $( and ) are used internally to define # macros. Do not use them in your own configuration!!! # # Whenever you see a set of lines such as: # x=value # y=$(x)\something # # the final value for y will be value\something # Define two status worker: # - jk-status for read-only use # - jk-manager for read/write use worker.list=jk-status worker.jk-status.type=status worker.jk-status.read_only=true worker.list=jk-manager worker.list=worker1 worker.jk-manager.type=status # We define a load balancer worker # with name balancer worker.list=balancer worker.balancer.type=lb # error_escalation_time: seconds, default = recover_time/2 (=30) # Determines, how fast a detected error should switch from # local error state to global error state # Since: 1.2.28 worker.balancer.error_escalation_time=0 # - max_reply_timeouts: number, default=0 # If there are to many reply timeouts, a worker # is put into the error state, i.e. it will become # unavailable for all sessions residing on the respective # Tomcat. The number of tolerated reply timeouts is # configured with max_reply_timeouts. The number of # timeouts occuring is divided by 2 once a minute and the # resulting counter is compared against max_reply_timeouts. # If you set max_reply_timeouts to N and the errors are # occuring equally distributed over time, you will # tolerate N/2 errors per minute. If they occur in a burst # you will tolerate N errors. # Since: 1.2.24 worker.balancer.max_reply_timeouts=10 # Now we add members to the load balancer # First member is node1, most # attributes are inherited from the # template worker.template. worker.balancer.balance_workers=worker1
Re: Apache Accessing Tomcat Issue
On 30.03.2013 12:43, Chris Arnold wrote: Here is the modified virtualhost file: VirtualHost *:80 ServerName share.domain.com #RewriteEngine On #RewriteCond %{REQUEST_URI} !^/share/ #RewriteCond %{HTTPS} on #RewriteRule ^/. http://share.domain.com/share/ [P] JkMount /share|/* worker1 As mentioned I suggest to use balancer instead of worker1 here. RedirectMatch ^/$ http://share.domain.com/share/ ErrorLog /var/log/apache2/domain.com-error_log CustomLog /var/log/apache2/domain.com-access_log combined /VirtualHost OK, one thing I forgot, sorry: this config uses a load balancer worker which even if there's only one Tomcat instance involved allows a bit more of control. For this to work you need to replace the name worker1 in the above JkMount with balancer: JkMount /share|/* balancer See above. Give it a try (with! I dont understand the With! part. Is that part of the apache restart command to force? Me neither, somehow part f the text got deleted. Probably just wanted to say with the above adjustments). If it doesn't work, increase the JkLogLevel to debug and post the JK log file contents (and the Apache error log and access log entries for your test requests). Well, now apache does not start. Gives this error: error in reading worker properties from /opt/path to/worker.properties Is the path in the error the correct one? Configuration failed Seems it doesn't like something about the worker.properties file. Due to that i will post the complete workers.properties file (it is writeable): What's in the JK log? The following param doesn't exist in your old version: # error_escalation_time: seconds, default = recover_time/2 (=30) # Determines, how fast a detected error should switch from # local error state to global error state # Since: 1.2.28 worker.balancer.error_escalation_time=0 That following port likely is wrong. you need to configure the AJP port of Tomcat, something like 8009 or whataver you have chosen in server.xml. Make sure the AJP port in server.xml is not commented out. worker.worker1.port=8080 The following param doesn't exist in your old version: # - socket_connect_timeout: milliseconds, default=0 # Since: 1.2.27 worker.template.socket_connect_timeout=5000 The following params don't exist in your old version: # - ping_mode: Character, default=none # When should we use cping/cpong connection probing? # C = directly after establishing a new connection # P = directly before sending each request # I = in regular intervals for idle connections # using the watchdog thread # A = all of the above # Since: 1.2.27 worker.template.ping_mode=A # - ping_timeout: milliseconds, default=1 # Wait timeout for cpong after cping # Can be overwritten for modes C and P # Using connect_timeout and prepost_timeout. # Since: 1.2.27 worker.template.ping_timeout=1 The following param doesn't exist in your old version: # - reply_timeout: milliseconds, default=0 # Any pause longer than this timeout during waiting # for a part of the reply will abort handling the request # in mod_jk. The request will proceed running in # Tomcat, but the web server resources will be freed # and an error is send to the client. # For individual requests, the timeout can be overwritten # by the Apache environment variable JK_REPLY_TIMEOUT. # JK_REPLY_TIMEOUT since: 1.2.27 worker.template.reply_timeout=30 Regards, Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Apache Accessing Tomcat Issue
On 30.03.2013 12:43, Chris Arnold wrote The following param doesn't exist in your old version: # error_escalation_time: seconds, default = recover_time/2 (=30) # Determines, how fast a detected error should switch from # local error state to global error state # Since: 1.2.28 worker.balancer.error_escalation_time=0 The following were not in the original post as i snipped these out in order to post only what i thought was important. They have always existed in the file since i downloaded the one you pointed me too. That following port likely is wrong. you need to configure the AJP port of Tomcat, something like 8009 or whataver you have chosen in server.xml. Make sure the AJP port in server.xml is not commented out. worker.worker1.port=8080 Yes, i changed this to 8009 as stade in the server xml The following param doesn't exist in your old version: # - socket_connect_timeout: milliseconds, default=0 # Since: 1.2.27 worker.template.socket_connect_timeout=5000 See above and ended up having to comment this out as it is not supported in the version of mod_jk i am using. The following params don't exist in your old version: # - ping_mode: Character, default=none # When should we use cping/cpong connection probing? # C = directly after establishing a new connection # P = directly before sending each request # I = in regular intervals for idle connections # using the watchdog thread # A = all of the above # Since: 1.2.27 worker.template.ping_mode=A # - ping_timeout: milliseconds, default=1 # Wait timeout for cpong after cping # Can be overwritten for modes C and P # Using connect_timeout and prepost_timeout. # Since: 1.2.27 worker.template.ping_timeout=1 See above and ended up having to comment this out as it is not supported in the version of mod_jk i am using. The following param doesn't exist in your old version: # - reply_timeout: milliseconds, default=0 # Any pause longer than this timeout during waiting # for a part of the reply will abort handling the request # in mod_jk. The request will proceed running in # Tomcat, but the web server resources will be freed # and an error is send to the client. # For individual requests, the timeout can be overwritten # by the Apache environment variable JK_REPLY_TIMEOUT. # JK_REPLY_TIMEOUT since: 1.2.27 worker.template.reply_timeout=30 See above and ended up having to comment this out as it is not supported in the version of mod_jk i am using. Apache finally started after commenting those out and changing the port. And i can now access http://share.domain.com Ranier, thank you for your time and instruction. Shall i send you some paypal monies? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Apache Accessing Tomcat Issue
On 29/03/2013 10:29 AM, Chris Arnold carn...@electrichendrix.com wrote: Apache Tomcat/7.0.30 on SLES11 SP2. I am trying to configure access to a webapp using http://share.domain.com. This webapp uses port 8080 and works fine from inside the LAN. However, we have an apache2 server acting as a proxy and we want users to not have to type in a port number. Now when accessing http://share.domain.com, the result is directories and files are listed, the jsp files are not running. Here is my complete setup: You cant overlap apache and tomcat file system jk.conf- # simple configuration for apache (for AJP connector, modul mod_jk.so) IfModule mod_jk.c JkWorkersFile /opt/alfresco/tomcat/workers.properties JkLogFile /var/log/alfresco/mod_jk.log JkShmFile /var/log/alfresco/shm # Log level to be used by mod_jk JkLogLevel error # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 JkMount /share/*.jsp ajp13 /IfModule virtualhost- VirtualHost *:80 ServerName share.domain.com #RewriteEngine On #RewriteCond %{REQUEST_URI} !^/share/ #RewriteCond %{HTTPS} on #RewriteRule ^/. http://share.paradixent.com/share/ [P] #JkMount /share/* worker1 IfModule mod_jk.c # The following line makes apache aware of the location of # the /jsp-examples context Alias /share /opt/alfresco/tomcat/webapps/share Directory /opt/alfresco/tomcat/webapps/share Options Indexes FollowSymLinks allow from all /Directory # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 JkMount /share/*.jsp ajp13 # The following line prohibits users from directly accessing WEB-INF Location /share/WEB-INF/ #AllowOverride None deny from all /Location # if not specified, the global error log is used ErrorLog /var/log/apache2domain.com-error_log CustomLog /var/log/apache2/domain.com-access_log combined /IfModule /VirtualHost httpd.conf- # mod_jk Include /opt/alfresco/tomcat/conf/jk.conf Mod_jk is loaded: web:~ # /usr/sbin/httpd2 -M Loaded Modules: ... jk_module (shared) perl_module (shared) php5_module (shared) Syntax OK Here is the log from apache: [Thu Mar 28 18:40:14 2013] [error] [client pub ip] proxy: Error reading from remote server returned by /error/HTTP_INTERNAL_SERVER_ERROR.html.var [Thu Mar 28 18:40:28 2013] [error] [client pub ip] (70007)The timeout specified has expired: proxy: error reading status line from remote server share.paradixent.com [Thu Mar 28 18:40:28 2013] [error] [client pub ip] proxy: Error reading from remote server returned by /error/HTTP_INTERNAL_SERVER_ERROR.html.var Any ideas why the folder and files are being listed instead of running? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Apache Accessing Tomcat Issue
On 29.03.2013 00:24, Chris Arnold wrote: Apache Tomcat/7.0.30 on SLES11 SP2. I am trying to configure access to a webapp using http://share.domain.com. This webapp uses port 8080 and works fine from inside the LAN. However, we have an apache2 server acting as a proxy and we want users to not have to type in a port number. Now when accessing http://share.domain.com, the result is directories and files are listed, the jsp files are not running. Here is my complete setup: jk.conf- # simple configuration for apache (for AJP connector, modul mod_jk.so) IfModule mod_jk.c JkWorkersFile /opt/alfresco/tomcat/workers.properties JkLogFile /var/log/alfresco/mod_jk.log JkShmFile /var/log/alfresco/shm # Log level to be used by mod_jk JkLogLevel error # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 JkMount /share/*.jsp ajp13 Note that you only forward JSP-Requests here. might be OK, depending on the application. /IfModule virtualhost- VirtualHost *:80 ServerName share.domain.com #RewriteEngine On #RewriteCond %{REQUEST_URI} !^/share/ #RewriteCond %{HTTPS} on #RewriteRule ^/. http://share.paradixent.com/share/ [P] #JkMount /share/* worker1 Although the proxy rewrite rules are commented out here, later down the log indicates you are still somewhere using mod_proxy instead of mod_jk. IfModule mod_jk.c # The following line makes apache aware of the location of # the /jsp-examples context Alias /share /opt/alfresco/tomcat/webapps/share Directory /opt/alfresco/tomcat/webapps/share Options Indexes FollowSymLinks allow from all /Directory You can let Apache serve static content directly from an exploded webapp, but it is generally not recommended, because you then also open up stuff that's not expected to be made public to requests from outside. If below share there's anything that's not meant to be served by Apache, then it would be beter to copy the stuff that Apache should serve to a separate directory, which would then be the one to put into the Alias. # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 JkMount /share/*.jsp ajp13 # The following line prohibits users from directly accessing WEB-INF Location /share/WEB-INF/ #AllowOverride None deny from all /Location That's one exampe for stuff you don't want to be served, META-INF as well (if existing), there could be other stuff as well. # if not specified, the global error log is used ErrorLog /var/log/apache2domain.com-error_log CustomLog /var/log/apache2/domain.com-access_log combined /IfModule /VirtualHost httpd.conf- # mod_jk Include /opt/alfresco/tomcat/conf/jk.conf Mod_jk is loaded: web:~ # /usr/sbin/httpd2 -M Loaded Modules: ... jk_module (shared) perl_module (shared) php5_module (shared) Syntax OK Here is the log from apache: [Thu Mar 28 18:40:14 2013] [error] [client pub ip] proxy: Error reading from remote server returned by /error/HTTP_INTERNAL_SERVER_ERROR.html.var [Thu Mar 28 18:40:28 2013] [error] [client pub ip] (70007)The timeout specified has expired: proxy: error reading status line from remote server share.paradixent.com [Thu Mar 28 18:40:28 2013] [error] [client pub ip] proxy: Error reading from remote server returned by /error/HTTP_INTERNAL_SERVER_ERROR.html.var What's the request you send? What's the expected response and what's the actual response? The above log snippet tells us that somewhere in your config you have mod_proxy active, which is an alternative way to connect to a backend. You should get your idea straight, for which URLs you are using mod_proxy and for which mod_jk. I would suggest to stick with one. You didn't show us your worker.properties file. You didn't show us your mod_jk log file. Regards, Rainer - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Apache Accessing Tomcat Issue
On 29.03.2013 00:24, Chris Arnold wrote: # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 JkMount /share/*.jsp ajp13 Note that you only forward JSP-Requests here. might be OK, depending on the application. The application, just for reference, is alfresco #RewriteEngine On #RewriteCond %{REQUEST_URI} !^/share/ #RewriteCond %{HTTPS} on #RewriteRule ^/. http://share.paradixent.com/share/ [P] #JkMount /share/* worker1 Although the proxy rewrite rules are commented out here, later down the log indicates you are still somewhere using mod_proxy instead of mod_jk. mod_proxy is used on this installation of apache. I am told i need to use mod_jk in this instance. I need users to access this application like so: http://share.domain.com and using mod_jk is the easiest way to do this (thats what i am told) IfModule mod_jk.c # The following line makes apache aware of the location of # the /jsp-examples context Alias /share /opt/alfresco/tomcat/webapps/share Directory /opt/alfresco/tomcat/webapps/share Options Indexes FollowSymLinks allow from all /Directory You can let Apache serve static content directly from an exploded webapp, but it is generally not recommended, because you then also open up stuff that's not expected to be made public to requests from outside. I understand this If below share there's anything that's not meant to be served by Apache, then it would be beter to copy the stuff that Apache should serve to a separate directory, which would then be the one to put into the Alias. but wouldn't this still have stuff below /share open? # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 JkMount /share/*.jsp ajp13 # The following line prohibits users from directly accessing WEB-INF Location /share/WEB-INF/ #AllowOverride None deny from all /Location That's one exampe for stuff you don't want to be served, META-INF as well (if existing), there could be other stuff as well. # if not specified, the global error log is used ErrorLog /var/log/apache2domain.com-error_log CustomLog /var/log/apache2/domain.com-access_log combined /IfModule /VirtualHost httpd.conf- # mod_jk Include /opt/alfresco/tomcat/conf/jk.conf Mod_jk is loaded: web:~ # /usr/sbin/httpd2 -M Loaded Modules: ... jk_module (shared) perl_module (shared) php5_module (shared) Syntax OK Here is the log from apache: [Thu Mar 28 18:40:14 2013] [error] [client pub ip] proxy: Error reading from remote server returned by /error/HTTP_INTERNAL_SERVER_ERROR.html.var [Thu Mar 28 18:40:28 2013] [error] [client pub ip] (70007)The timeout specified has expired: proxy: error reading status line from remote server share.paradixent.com [Thu Mar 28 18:40:28 2013] [error] [client pub ip] proxy: Error reading from remote server returned by /error/HTTP_INTERNAL_SERVER_ERROR.html.var What's the request you send? i assume you are asking for the link? Which is http://share.domain.com What's the expected response a login page and what's the actual response? depending on whether i have the rewrite rules commented out or not, uncommented is a directory listing. Commented out is eventually a 503 Bad Gateway. The above log snippet tells us that somewhere in your config you have mod_proxy active, which is an alternative way to connect to a backend. You should get your idea straight, for which URLs you are using mod_proxy and for which mod_jk. I would suggest to stick with one. If it possible to use mod_proxy and have users access http://share.domain.com, thats what i would like to do. I have been unable to accomplish this result and therefore have tried mod_jk. You didn't show us your worker.properties file. workers.properties- # OPTIONS ( very important for jni mode ) # # workers.tomcat_home should point to the location where you # installed tomcat. This is where you have your conf, webapps and lib # directories. # workers.tomcat_home=/opt/alfresco/tomcat # # workers.java_home should point to your Java installation. Normally # you should have a bin and lib directories beneath it. # workers.java_home=/opt/IBMJava2-13 # # You should configure your environment slash... ps=\ on NT and / on UNIX # and maybe something different elsewhere. # ps=/ # #-- ADVANCED MODE #- # # #-- DEFAULT worker list -- #- # # # The workers that your plugins should create and work with # # Add 'inprocess' if you want JNI connector worker.list=ajp12, ajp13 # , inprocess # #-- DEFAULT ajp12 WORKER DEFINITION
Re: Apache Accessing Tomcat Issue
What's the request you send? i assume you are asking for the link? Which is http://share.domain.com What's the expected response a login page and what's the actual response? Now, it is a 403: [Fri Mar 29 08:15:24 2013] [error] [client pub ip] Directory index forbidden by Options directive: /srv/www/htdocs/ - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Apache Accessing Tomcat Issue
On 29.03.2013 13:10, Chris Arnold wrote: On 29.03.2013 00:24, Chris Arnold wrote: # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 JkMount /share/*.jsp ajp13 Note that you only forward JSP-Requests here. might be OK, depending on the application. The application, just for reference, is alfresco #RewriteEngine On #RewriteCond %{REQUEST_URI} !^/share/ #RewriteCond %{HTTPS} on #RewriteRule ^/. http://share.paradixent.com/share/ [P] #JkMount /share/* worker1 Although the proxy rewrite rules are commented out here, later down the log indicates you are still somewhere using mod_proxy instead of mod_jk. mod_proxy is used on this installation of apache. I am told i need to use mod_jk in this instance. I need users to access this application like so: http://share.domain.com and using mod_jk is the easiest way to do this (thats what i am told) So mod_proxy is loaded but you don't want to use it to access alfresco, instead just mod_jk, right? Then don't use any ReWriteRule with the [P} flag or any Proxy... directive. OK as above, since commented, so not active. IfModule mod_jk.c # The following line makes apache aware of the location of # the /jsp-examples context Alias /share /opt/alfresco/tomcat/webapps/share Directory /opt/alfresco/tomcat/webapps/share Options Indexes FollowSymLinks allow from all /Directory You can let Apache serve static content directly from an exploded webapp, but it is generally not recommended, because you then also open up stuff that's not expected to be made public to requests from outside. I understand this If below share there's anything that's not meant to be served by Apache, then it would be beter to copy the stuff that Apache should serve to a separate directory, which would then be the one to put into the Alias. but wouldn't this still have stuff below /share open? Assume all static images, css, js are in some /path/to/my/folder/static and there's nothing else underneath it, that folder would be a place to publish directly via Alias in Apache. # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 JkMount /share/*.jsp ajp13 # The following line prohibits users from directly accessing WEB-INF Location /share/WEB-INF/ #AllowOverride None deny from all /Location That's one exampe for stuff you don't want to be served, META-INF as well (if existing), there could be other stuff as well. # if not specified, the global error log is used ErrorLog /var/log/apache2domain.com-error_log CustomLog /var/log/apache2/domain.com-access_log combined /IfModule /VirtualHost httpd.conf- # mod_jk Include /opt/alfresco/tomcat/conf/jk.conf Mod_jk is loaded: web:~ # /usr/sbin/httpd2 -M Loaded Modules: ... jk_module (shared) perl_module (shared) php5_module (shared) Syntax OK Here is the log from apache: [Thu Mar 28 18:40:14 2013] [error] [client pub ip] proxy: Error reading from remote server returned by /error/HTTP_INTERNAL_SERVER_ERROR.html.var [Thu Mar 28 18:40:28 2013] [error] [client pub ip] (70007)The timeout specified has expired: proxy: error reading status line from remote server share.paradixent.com [Thu Mar 28 18:40:28 2013] [error] [client pub ip] proxy: Error reading from remote server returned by /error/HTTP_INTERNAL_SERVER_ERROR.html.var What's the request you send? i assume you are asking for the link? Which is http://share.domain.com I'm guessing here: what you want is that the request for http://share.domain.com should be forwarded to the Tomcat web application names share. For that I would put the following directives into the Apache VirtualHost that actually serves the request. - Add a redirect for the URI / to /share/ to the Apache config: RedirectMatch ^/$ http://share.domain.com/share/ - Forward all requests that point below /share to Tomcat and let them be served by the webapp: JkMount /share|/* myworker You can choose any name for myworker, but see below for workers.properties. - Remove other JkMount, Alias etc. At this step: - do not try to serve static content from Apache, first get this to work before adding the additional complexity. - do not try to make the webapp /share/ directly available under the top level directory. It is OK to redirect the a request for http://share.domain.com/ to http://share.domain.com/share/ and proceed from there as above, but it is harder to remove the share URI path component from each request. If you really need to do this, then use mod_proxy, not mod_jk. What's the expected response a login page and what's the actual response? depending on whether i have the rewrite rules commented out or not, uncommented is a directory listing. Commented out is
Re: Apache Accessing Tomcat Issue
This thread is getting kinda messy so i am going to snip a bunch of stuff and answer your latest info. So mod_proxy is loaded but you don't want to use it to access alfresco, instead just mod_jk, right? Then don't use any ReWriteRule with the [P} flag or any Proxy... directive. No, if this can be done with mod_proxy, i would prefer to do that. I have been unable to get mod_proxy working so users type http://share.domain.com and get the required results (which is http://share.domain.com/share) Assume all static images, css, js are in some /path/to/my/folder/static and there's nothing else underneath it, that folder would be a place to publish directly via Alias in Apache. OK I'm guessing here: what you want is that the request for http://share.domain.com should be forwarded to the Tomcat web application names share. Exactly For that I would put the following directives into the Apache VirtualHost that actually serves the request. - Add a redirect for the URI / to /share/ to the Apache config: RedirectMatch ^/$ http://share.domain.com/share/ - Forward all requests that point below /share to Tomcat and let them be served by the webapp: JkMount /share|/* myworker - Remove other JkMount, Alias etc. Here is the modified virtualhost file: VirtualHost *:80 ServerName share.domain.com #RewriteEngine On #RewriteCond %{REQUEST_URI} !^/share/ #RewriteCond %{HTTPS} on #RewriteRule ^/. http://share.domain.com/share/ [P] JkMount /share|/* worker1 RedirectMatch ^/$ http://share.domain.com/share/ IfModule mod_jk.c # The following line makes apache aware of the location of # the /jsp-examples context #Alias /share /opt/alfresco/tomcat/webapps/share #Directory /opt/alfresco/tomcat/webapps/share #Options Indexes FollowSymLinks #allow from all #/Directory # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 #JkMount /share/*.jsp ajp13 # The following line prohibits users from directly accessing WEB-INF #Location /share/WEB-INF/ #AllowOverride None #deny from all #/Location # if not specified, the global error log is used ErrorLog /var/log/apache2/domain.com-error_log CustomLog /var/log/apache2/domain.com-access_log combined /IfModule /VirtualHost At this step: - do not try to serve static content from Apache, first get this to work before adding the additional complexity. - do not try to make the webapp /share/ directly available under the top level directory. It is OK to redirect the a request for http://share.domain.com/ to http://share.domain.com/share/ and proceed from there as above, but it is harder to remove the share URI path component from each request. If you really need to do this, then use mod_proxy, not mod_jk. Doing the above, does that take care of what you stated here? Don't use this configuration. It is garbage. Download a mod_jk source distribution (recent is version 1.2.37) which contains a nive default workers.properties file. You can also get it here: http://svn.apache.org/viewvc/tomcat/jk/trunk/conf/workers.properties?view=co In that file, remove all lines referring to node2 and replace node1 by whatever worker name you have chosen in JkMount (myworker or whatever). Finally set host and port of that worker to whatever port and server name your Tomcat listens to. Here is the new workers.properties file: .. # the final value for y will be value\something # Define two status worker: # - jk-status for read-only use # - jk-manager for read/write use worker.list=jk-status worker.jk-status.type=status worker.jk-status.read_only=true worker.list=jk-manager worker.jk-manager.type=status # We define a load balancer worker # with name balancer worker.list=balancer worker.balancer.type=lb # error_escalation_time: seconds, default = recover_time/2 (=30) # Determines, how fast a detected error should switch from # local error state to global error state # Since: 1.2.28 worker.balancer.error_escalation_time=0 # - max_reply_timeouts: number, default=0 # If there are to many reply timeouts, a worker # is put into the error state, i.e. it will become # unavailable for all sessions residing on the respective # Tomcat. The number of tolerated reply timeouts is # configured with max_reply_timeouts. The number of # timeouts occuring is divided by 2 once a minute and the # resulting counter is compared against max_reply_timeouts. # If you set max_reply_timeouts to N and the errors are # occuring equally distributed over time, you will # tolerate N/2 errors per minute. If they occur in a burst # you will tolerate N errors. # Since: 1.2.24 worker.balancer.max_reply_timeouts=10 # Now we add members to the load balancer # First member is node1, most # attributes are inherited from the # template worker.template. worker.balancer.balance_workers=worker1
Re: Apache Accessing Tomcat Issue
On 29.03.2013 18:02, Chris Arnold wrote: This thread is getting kinda messy so i am going to snip a bunch of stuff and answer your latest info. Good. So mod_proxy is loaded but you don't want to use it to access alfresco, instead just mod_jk, right? Then don't use any ReWriteRule with the [P} flag or any Proxy... directive. No, if this can be done with mod_proxy, i would prefer to do that. I have been unable to get mod_proxy working so users type http://share.domain.com and get the required results (which is http://share.domain.com/share) Let's stick to mod_jk for the moment. I think you are close. Here is the modified virtualhost file: VirtualHost *:80 ServerName share.domain.com #RewriteEngine On #RewriteCond %{REQUEST_URI} !^/share/ #RewriteCond %{HTTPS} on #RewriteRule ^/. http://share.domain.com/share/ [P] JkMount /share|/* worker1 RedirectMatch ^/$ http://share.domain.com/share/ IfModule mod_jk.c # The following line makes apache aware of the location of # the /jsp-examples context #Alias /share /opt/alfresco/tomcat/webapps/share #Directory /opt/alfresco/tomcat/webapps/share #Options Indexes FollowSymLinks #allow from all #/Directory # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 #JkMount /share/*.jsp ajp13 # The following line prohibits users from directly accessing WEB-INF #Location /share/WEB-INF/ #AllowOverride None #deny from all #/Location # if not specified, the global error log is used ErrorLog /var/log/apache2/domain.com-error_log CustomLog /var/log/apache2/domain.com-access_log combined /IfModule /VirtualHost Looks good to me, you can remove the IfModule tags. They don't contain anything mod_jk specific any more and in fact if mod_jk is not loaded you'd want the whole thing to bomb at startup and not just ignore mod_jk config. You've chosen the worker name worker1. Fine. At this step: - do not try to serve static content from Apache, first get this to work before adding the additional complexity. - do not try to make the webapp /share/ directly available under the top level directory. It is OK to redirect the a request for http://share.domain.com/ to http://share.domain.com/share/ and proceed from there as above, but it is harder to remove the share URI path component from each request. If you really need to do this, then use mod_proxy, not mod_jk. Doing the above, does that take care of what you stated here? Looks good to me. Here is the new workers.properties file: .. # the final value for y will be value\something # Define two status worker: # - jk-status for read-only use # - jk-manager for read/write use worker.list=jk-status worker.jk-status.type=status worker.jk-status.read_only=true worker.list=jk-manager worker.jk-manager.type=status # We define a load balancer worker # with name balancer worker.list=balancer worker.balancer.type=lb # error_escalation_time: seconds, default = recover_time/2 (=30) # Determines, how fast a detected error should switch from # local error state to global error state # Since: 1.2.28 worker.balancer.error_escalation_time=0 # - max_reply_timeouts: number, default=0 # If there are to many reply timeouts, a worker # is put into the error state, i.e. it will become # unavailable for all sessions residing on the respective # Tomcat. The number of tolerated reply timeouts is # configured with max_reply_timeouts. The number of # timeouts occuring is divided by 2 once a minute and the # resulting counter is compared against max_reply_timeouts. # If you set max_reply_timeouts to N and the errors are # occuring equally distributed over time, you will # tolerate N/2 errors per minute. If they occur in a burst # you will tolerate N errors. # Since: 1.2.24 worker.balancer.max_reply_timeouts=10 # Now we add members to the load balancer # First member is node1, most # attributes are inherited from the # template worker.template. worker.balancer.balance_workers=worker1 worker.worker1.reference=worker.template worker.worker1.host=localhost worker.worker1.port=8080 # Activation allows to configure # whether this node should actually be used # A: active (use node fully) # D: disabled (only use, if sticky session needs this node) # S: stopped (do not use) # Since: 1.2.19 worker.worker1.activation=A # Second member is node2, most # attributes are inherited from the # template worker.template. #worker.balancer.balance_workers=node2 #worker.node2.reference=worker.template #worker.node2.host=localhost #worker.node2.port=8209 # Activation allows to configure # whether this node should actually be used # A: active (use node fully) # D: disabled (only use, if sticky session needs this node) # S: stopped (do not
Apache Accessing Tomcat Issue
Apache Tomcat/7.0.30 on SLES11 SP2. I am trying to configure access to a webapp using http://share.domain.com. This webapp uses port 8080 and works fine from inside the LAN. However, we have an apache2 server acting as a proxy and we want users to not have to type in a port number. Now when accessing http://share.domain.com, the result is directories and files are listed, the jsp files are not running. Here is my complete setup: jk.conf- # simple configuration for apache (for AJP connector, modul mod_jk.so) IfModule mod_jk.c JkWorkersFile /opt/alfresco/tomcat/workers.properties JkLogFile /var/log/alfresco/mod_jk.log JkShmFile /var/log/alfresco/shm # Log level to be used by mod_jk JkLogLevel error # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 JkMount /share/*.jsp ajp13 /IfModule virtualhost- VirtualHost *:80 ServerName share.domain.com #RewriteEngine On #RewriteCond %{REQUEST_URI} !^/share/ #RewriteCond %{HTTPS} on #RewriteRule ^/. http://share.paradixent.com/share/ [P] #JkMount /share/* worker1 IfModule mod_jk.c # The following line makes apache aware of the location of # the /jsp-examples context Alias /share /opt/alfresco/tomcat/webapps/share Directory /opt/alfresco/tomcat/webapps/share Options Indexes FollowSymLinks allow from all /Directory # The following line mounts all JSP files and the /servlet/ uri to tomcat #JkMount /servlets-examples/servlet/* ajp13 JkMount /share/*.jsp ajp13 # The following line prohibits users from directly accessing WEB-INF Location /share/WEB-INF/ #AllowOverride None deny from all /Location # if not specified, the global error log is used ErrorLog /var/log/apache2domain.com-error_log CustomLog /var/log/apache2/domain.com-access_log combined /IfModule /VirtualHost httpd.conf- # mod_jk Include /opt/alfresco/tomcat/conf/jk.conf Mod_jk is loaded: web:~ # /usr/sbin/httpd2 -M Loaded Modules: ... jk_module (shared) perl_module (shared) php5_module (shared) Syntax OK Here is the log from apache: [Thu Mar 28 18:40:14 2013] [error] [client pub ip] proxy: Error reading from remote server returned by /error/HTTP_INTERNAL_SERVER_ERROR.html.var [Thu Mar 28 18:40:28 2013] [error] [client pub ip] (70007)The timeout specified has expired: proxy: error reading status line from remote server share.paradixent.com [Thu Mar 28 18:40:28 2013] [error] [client pub ip] proxy: Error reading from remote server returned by /error/HTTP_INTERNAL_SERVER_ERROR.html.var Any ideas why the folder and files are being listed instead of running? - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org