Re: Paths for JkMount
Greg Scott wrote: -Message d'origine- De : Greg Scott [mailto:[EMAIL PROTECTED] Envoyé : 11 juin 2005 23:41 À : tomcat-user@jakarta.apache.org Cc : [EMAIL PROTECTED]; Joan Kinnischtzke; Michael R Ponicki Objet : Paths for JkMount Hello - I am working on a proof of concept application, porting from tomcat 3.n and Apache 1.3 to Tomcat 5.5.9 and Apache 2.0.52. The problem - every time this app would try to execute a .jsp file, Apache would return an error. After a bunch of troubleshooting in httpd.conf, I found the problem. It was these JkMount directives: JkMount /servlets/* worker1 JkMount /*.jsp worker1 JkMount /*.do worker1 I was assuming these paths were all really relative to my DocumentRoot - but noo! The path evidently needs to be a real, absolute path. These directives work: JkMount /var/www/html/{approot}/servlets/* worker1 JkMount /var/www/html/{approot}/*.jsp worker1 JkMount /var/www/html/{approot}/*.do worker1 (where {approot} is the directory with all the html, jsp, and other files.) And now the app seems to behave properly. But this bothers me - aren't all these supposed to be relative to DocumentRoot? Am I missing something or are JkMount directives supposed to point to an absolute path? The docs say those are DocumentRoot relative paths - or to be more precise, those are URIs, just like "uri" section of "workers2.properties" in mod_jk2. Coule it be that those directives are inside a and that *that* is causing file path to be assumed, instead of URI? Nix. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Paths for JkMount
Just use an auto-configuration script provided by Tomcat http://jakarta.apache.org/tomcat/connectors-doc/howto/apache.html Look at 'Installation' -> 'Using Tomcat auto-configure' section** <http://jakarta.apache.org/tomcat/connectors-doc/howto/apache.html> Thank you Luc - My JkMount directives are inside an an included file, which is itself inside a directive in httpd.conf, almost at the bottom of section 3. Why wouldn't this work? The idea was, if we decide to host more than one of these on the same system, we can put the JkMount directives inside the appropriate in http.conf. Also note, I lifted this arrangement right out of a working Apache 1.3 and Tomcat 3.3 setup. Here are the relevant sections of httpd.conf and my include file. I substituted the string, "webname" for the real name of the site when it goes live: [EMAIL PROTECTED] conf]# tail httpd.conf -c 1090 # configuration. # # Use name-based virtual hosting. # #NameVirtualHost *:80 NameVirtualHost webname.greg.local:80 # # NOTE: NameVirtualHost cannot be used without a port specifier # (e.g. :80) if mod_ssl is being used, due to the nature of the # SSL protocol. # ServerAdmin [EMAIL PROTECTED] DocumentRoot /var/www/html/webname/ ### ServerName www.webnamekids.org ServerName webname.greg.local ### ServerAlias development.webnamekids.org staging.webnamekids.org include /etc/httpd/conf/webname.conf # # 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. # # #ServerAdmin [EMAIL PROTECTED] #DocumentRoot /www/docs/dummy-host.example.com #ServerName dummy-host.example.com #ErrorLog logs/dummy-host.example.com-error_log #CustomLog logs/dummy-host.example.com-access_log common # [EMAIL PROTECTED] conf]# And here is the include file: [EMAIL PROTECTED] conf]# more webname.conf # # www.webnamekids.com # ###SetEnvIf Remote_Addr 10\.10\.10\.78 BADIP LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combine d CustomLog "| /usr/sbin/rotatelogs /var/log/webname_access_log 259200" combin ed env=!BADIP ###DocumentRoot /usr/local/websites/webname/ # Already setup in httpd.conf ##JkMount /servlets/* ajp13 ##JkMount /*.jsp ajp13 ##JkMount /*.do ajp13 ##JkMount /servlets/* worker1 ##JkMount /*.jsp worker1 ##JkMount /*.do worker1 JkMount /var/www/html/webname/servlets/* worker1 JkMount /var/www/html/webname/*.jsp worker1 JkMount /var/www/html/webname/*.do worker1 #UserDir disabled AddHandler server-parsed .html .shtml. htm ErrorDocument 404 /notfound.html # #Options None #AllowOverride None # # Note that from this point forward you must specifically allow # particular features to be enabled - so if something's not working as # you might expect, make sure that you have specifically enabled it # below. Options Indexes FollowSymLinks Includes AllowOverride All DirectoryIndex index.html index.shtml index.jsp # There have been reports of people trying to abuse an old bug from pre-1.1 # days. This bug involved a CGI script distributed as a part of Apache. # By uncommenting these lines you can redirect these attacks to a logging # script on phf.apache.org. Or, you can record them yourself, using the script # support/phf_abuse_log.cgi. deny from all ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi # You may place any other directories or locations you wish to have # access information for after this one. ### [EMAIL PROTECTED] conf]# Thanks - Greg Scott -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 7:40 AM To: tomcat-user@jakarta.apache.org Subject: RE: Paths for JkMount Hi, I used relative path to mount files to Tomcat with the JkMount directive so I don't think your problem comes from that. First. Be sure that : - Aliasses have been created in httpd.conf - Your JkMount directives are placed between section 2 And 3 of httpd.conf - Your JkMount directives are placed AFTER the Alias Directives If that doesn't work, let us know. Luc Boudreau Université du Québec Canada -Message d'origine- De : Greg Scott [mailto:[EMAIL PROTECTED] Envoyé : 11 juin 2005 23:41 À : tomcat-user@jakarta.apache.org Cc : [EMAIL PROTECTED]; Joan Kinnischtzke; Michael R Ponicki Objet : Paths for JkMount Hello - I am working on a proof of concept application, porting from tomcat 3.n and Apache 1.3 to Tomcat 5.5.9 and Apache 2.0.52. The problem - every time this app would try to execute a .jsp file, Apache would return an error. After a bunch of troubleshooting in httpd.conf, I found the problem. It was these JkMount directives: JkMount /servlets/* worker1 JkMount /*.js
RE: Paths for JkMount
Hi, Well, I never made any research on Jk with Virtual Hosting, but I think this might help. It's a reply I gave to someone who asked for configuration instructions with Tomcat 5.5, Apache 2 and Jk. Hope it helps ! First, in httpd.conf, load your module : LoadModule jk_module modules/mod_jk.so Then, protect your WEB-INF directories : Options -Indexes FollowSymLinks Deny from all Then, between section 2 and 3 of httpd.conf, add the jk configuration : JkWorkersFile "conf/workers.properties" JkLogFile "logs/mod_jk.log" JkLogLevel info JkLogStampFormat "< %a %b %d %Y - %H:%M:%S > -=- " Create an alias : Alias /exampleApp c:/Tomcat5/webapps/exampleApp Define which files are to be served by Tomcat : JkMount / exampleApp/*.jsp tomcat5 JkMount / exampleApp/*.do tomcat5 (Note that here, tomcat5 refers to the name of the "worker" as defined in the workers.properties file. See below for details) Create two empty log files within the conf directory of apache with 777 rights : mod_jk.log and jk-tomcat5.log Create a workers.properties file in your Apache/conf directory and add this : ps=/ worker.list=tomcat5 worker.tomcat5.port=8008 worker.tomcat5.host=localhost worker.tomcat5.type=ajp13 worker.tomcat5.lbfactor=1 (This is a VERY simple configuration file. Refer to the Apache Jakarta webpage for details on how to configure this file.) In your Tomcat server.xml file, under the line : Add the following : At last, inside the "" tag, add: There you are ! It took me three days to figure that out, hope it serves you well !
RE: Paths for JkMount
Thank you Luc - My JkMount directives are inside an an included file, which is itself inside a directive in httpd.conf, almost at the bottom of section 3. Why wouldn't this work? The idea was, if we decide to host more than one of these on the same system, we can put the JkMount directives inside the appropriate in http.conf. Also note, I lifted this arrangement right out of a working Apache 1.3 and Tomcat 3.3 setup. Here are the relevant sections of httpd.conf and my include file. I substituted the string, "webname" for the real name of the site when it goes live: [EMAIL PROTECTED] conf]# tail httpd.conf -c 1090 # configuration. # # Use name-based virtual hosting. # #NameVirtualHost *:80 NameVirtualHost webname.greg.local:80 # # NOTE: NameVirtualHost cannot be used without a port specifier # (e.g. :80) if mod_ssl is being used, due to the nature of the # SSL protocol. # ServerAdmin [EMAIL PROTECTED] DocumentRoot /var/www/html/webname/ ### ServerName www.webnamekids.org ServerName webname.greg.local ### ServerAlias development.webnamekids.org staging.webnamekids.org include /etc/httpd/conf/webname.conf # # 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. # # #ServerAdmin [EMAIL PROTECTED] #DocumentRoot /www/docs/dummy-host.example.com #ServerName dummy-host.example.com #ErrorLog logs/dummy-host.example.com-error_log #CustomLog logs/dummy-host.example.com-access_log common # [EMAIL PROTECTED] conf]# And here is the include file: [EMAIL PROTECTED] conf]# more webname.conf # # www.webnamekids.com # ###SetEnvIf Remote_Addr 10\.10\.10\.78 BADIP LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combine d CustomLog "| /usr/sbin/rotatelogs /var/log/webname_access_log 259200" combin ed env=!BADIP ###DocumentRoot /usr/local/websites/webname/ # Already setup in httpd.conf ##JkMount /servlets/* ajp13 ##JkMount /*.jsp ajp13 ##JkMount /*.do ajp13 ##JkMount /servlets/* worker1 ##JkMount /*.jsp worker1 ##JkMount /*.do worker1 JkMount /var/www/html/webname/servlets/* worker1 JkMount /var/www/html/webname/*.jsp worker1 JkMount /var/www/html/webname/*.do worker1 #UserDir disabled AddHandler server-parsed .html .shtml. htm ErrorDocument 404 /notfound.html # #Options None #AllowOverride None # # Note that from this point forward you must specifically allow # particular features to be enabled - so if something's not working as # you might expect, make sure that you have specifically enabled it # below. Options Indexes FollowSymLinks Includes AllowOverride All DirectoryIndex index.html index.shtml index.jsp # There have been reports of people trying to abuse an old bug from pre-1.1 # days. This bug involved a CGI script distributed as a part of Apache. # By uncommenting these lines you can redirect these attacks to a logging # script on phf.apache.org. Or, you can record them yourself, using the script # support/phf_abuse_log.cgi. deny from all ErrorDocument 403 http://phf.apache.org/phf_abuse_log.cgi # You may place any other directories or locations you wish to have # access information for after this one. ### [EMAIL PROTECTED] conf]# Thanks - Greg Scott -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, June 13, 2005 7:40 AM To: tomcat-user@jakarta.apache.org Subject: RE: Paths for JkMount Hi, I used relative path to mount files to Tomcat with the JkMount directive so I don't think your problem comes from that. First. Be sure that : - Aliasses have been created in httpd.conf - Your JkMount directives are placed between section 2 And 3 of httpd.conf - Your JkMount directives are placed AFTER the Alias Directives If that doesn't work, let us know. Luc Boudreau Université du Québec Canada -Message d'origine- De : Greg Scott [mailto:[EMAIL PROTECTED] Envoyé : 11 juin 2005 23:41 À : tomcat-user@jakarta.apache.org Cc : [EMAIL PROTECTED]; Joan Kinnischtzke; Michael R Ponicki Objet : Paths for JkMount Hello - I am working on a proof of concept application, porting from tomcat 3.n and Apache 1.3 to Tomcat 5.5.9 and Apache 2.0.52. The problem - every time this app would try to execute a .jsp file, Apache would return an error. After a bunch of troubleshooting in httpd.conf, I found the problem. It was these JkMount directives: JkMount /servlets/* worker1 JkMount /*.jsp worker1 JkMount /*.do worker1 I was assuming these paths were all really relative to my DocumentRoot - but noo! The path evidently needs to be a real, absolute path. These directives work: JkMount /var/www/html/{approot}/servlets/* worker1
RE: Paths for JkMount
Hi, I used relative path to mount files to Tomcat with the JkMount directive so I don't think your problem comes from that. First. Be sure that : - Aliasses have been created in httpd.conf - Your JkMount directives are placed between section 2 And 3 of httpd.conf - Your JkMount directives are placed AFTER the Alias Directives If that doesn't work, let us know. Luc Boudreau Université du Québec Canada -Message d'origine- De : Greg Scott [mailto:[EMAIL PROTECTED] Envoyé : 11 juin 2005 23:41 À : tomcat-user@jakarta.apache.org Cc : [EMAIL PROTECTED]; Joan Kinnischtzke; Michael R Ponicki Objet : Paths for JkMount Hello - I am working on a proof of concept application, porting from tomcat 3.n and Apache 1.3 to Tomcat 5.5.9 and Apache 2.0.52. The problem - every time this app would try to execute a .jsp file, Apache would return an error. After a bunch of troubleshooting in httpd.conf, I found the problem. It was these JkMount directives: JkMount /servlets/* worker1 JkMount /*.jsp worker1 JkMount /*.do worker1 I was assuming these paths were all really relative to my DocumentRoot - but noo! The path evidently needs to be a real, absolute path. These directives work: JkMount /var/www/html/{approot}/servlets/* worker1 JkMount /var/www/html/{approot}/*.jsp worker1 JkMount /var/www/html/{approot}/*.do worker1 (where {approot} is the directory with all the html, jsp, and other files.) And now the app seems to behave properly. But this bothers me - aren't all these supposed to be relative to DocumentRoot? Am I missing something or are JkMount directives supposed to point to an absolute path? Thanks - Greg Scott [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]