You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2008/01/11 22:15:33 UTC

DO NOT REPLY [Bug 44215] New: - jkunmount causes apache to throw permission denied error

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44215>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=44215

           Summary: jkunmount causes apache to throw permission denied error
           Product: Tomcat 5
           Version: 5.5.25
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: Native:JK
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: yuelu@stanford.edu


I was trying to use JkUnMount directive to have gif files served by apache
instead of tomcat.  The gif files are originally in the
webapps/selfservice/images directory.  I copied them to the
/var/www/html/selfservice/images directory. I am getting apache error message:

******************************************************************************
You don't have permission to access /selfservice/images/welcome.gif on this server.
******************************************************************************

However if I add a rewrite rule:

******************************************************************************
RewriteRule ([^\/\.]+)\.(gif|jpg|jpeg|png|wbmp)$ /selfservice/images/$1.$2 [L]
******************************************************************************

it works fine.

My apache conf file is as follows:

**********************************************
DocumentRoot /var/www/html

LoadModule jk_module modules/mod_jk.so
JkWorkersFile "/etc/httpd/workers.properties"
JkLogFile "/var/log/httpd/mod_jk.log"
JkLogLevel debug
JkAutoAlias /usr/share/tomcat5/webapps
JkMount /selfservice/* worker1
JkUnMount /selfservice/*.html worker1
JkUnMount /selfservice/*.jpg  worker1
JkUnMount /selfservice/*.gif  worker1

<VirtualHost *:80>
    ServerName  www.examples.com
    ServerAlias examples
    DocumentRoot /var/www/html
</VirtualHost>
********************************************

The version of mod_jk is 1.2.21, apache is 2.0.52, tomcat is 5.5.25.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44215] - jkunmount causes apache to throw permission denied error

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44215>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=44215


rainer.jung@kippdata.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |WORKSFORME




------- Additional Comments From rainer.jung@kippdata.de  2008-01-12 03:48 -------
Out your JkMount/JkUnMount into the virtual host or add JkMountCopy On into the 
virtual host.

Not sure, what you are using "JkAutoAlias /usr/share/tomcat5/webapps" for, 
since you copied the static images to the appropriate DocumentRoot subfolder.

I'm closing this as "WORKSFORME", because it's most likely a configuration 
issue.

In case of moving the Jk(Un)Mount into the vhost doesn't help, please do also 
provide

- the contents of the httpd error logs
- the original URL your are using when trying to retrieve the image


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44215] - jkunmount causes apache to throw permission denied error

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44215>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=44215


rainer.jung@kippdata.de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |NEEDINFO




------- Additional Comments From rainer.jung@kippdata.de  2008-01-14 12:45 -------
I tested your setup. I have two different types of answers.

Part I: Questioning your setup

There are two things, which are in conflict in your setup:

- you set a JkAutoAlias. This says: if there is a JkMount in a vhost, but a 
request does not match, then look for the file below the directory given in the 
JkAutoAlias.

- you say, that the file does *not* exist in the appropriate sub directory of 
the directory given in JkAutoAlias, and instead it exists below the 
DocumentRoot.

So it looks like you want to serve the static content from the DocumentRoot. In 
this case simply remove the JkAutoAlias.


Part II: Testing your setup

1) JK version 1.2.21 as indicated in your first post: when requesting

http://www.examples.com/selfservice/images/welcome.gif

the config resolves this to

- do not forward to Tomcat
- use the JkAutoAlias
- return with file /usr/share/tomcat5/webapps/selfservice/images/welcome.gif

As you can see from Part I, this works as desinged. It actually works with or 
without JkMountCopy. No rewrite rule needed. The Jk log shows debug log lines

... [16927:0006] [debug] jk_translate::mod_jk.c (2878): check 
alias_dir: /usr/share/tomcat5/webapps
... [16927:0006] [debug] jk_translate::mod_jk.c (2904): AutoAlias child_dir: 
test.html
... [16927:0006] [debug] jk_translate::mod_jk.c (2939): AutoAlias OK for 
file: /usr/share/tomcat5/webapps/selfservice/test.html

The fact, that it works without JkMountCopy is a bug in 1.2.21.

2) Version 1.2.26: does *not* work either with or without JkMountCopy. Should 
work with JkMountCopy, but does not, because when cleaning up the mount 
handling in vhosts, we treated JkAutoAlias wrong :(

So: which version are you actually testing against? Is it still really 1.2.21, 
like you posted in your first message?

Concerning 1.2.26, the following patch against 1.2.26 should do the trick:

--- mod_jk.c.orig       2007-12-14 19:50:44.000000000 +0100
+++ mod_jk.c    2008-01-14 21:28:01.000000000 +0100
@@ -2551,6 +2551,8 @@
         }
         if (!overrides->mount_file)
             overrides->mount_file = base->mount_file;
+    }
+    if (overrides->mountcopy == JK_TRUE) {
         if (!overrides->alias_dir)
             overrides->alias_dir = base->alias_dir;
     }

Questions:

- which jk version?
- do you want to serve the files from the DocumentRoot or from the JkAutoAlias 
directory?
- does the file exist there?
- if you only request one of those static files, what's the jk debog log output?


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44215] - jkunmount causes apache to throw permission denied error

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44215>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=44215


yuelu@stanford.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |FIXED




------- Additional Comments From yuelu@stanford.edu  2008-01-14 18:50 -------
It turns out that apache doesn't have read permission to
/usr/share/tomcat5/webapps.  Sorry about the false alarm.  I have closed the bug.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44215] - jkunmount causes apache to throw permission denied error

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44215>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=44215


yuelu@stanford.edu changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WORKSFORME                  |




------- Additional Comments From yuelu@stanford.edu  2008-01-14 11:10 -------
Thanks for your response.  The image files and jsp files are both under the
/usr/share/tomcat5/webapps/selfservice directory.  For performance improvement,
we want to serve the static files directly from apache, but jsp files from
tomcat.  That's why we need to have JkAutoAlias /usr/share/tomcat5/webapps in
the conf file.

Here is what we see:
We request the URL http://www.examples.com/selfservice/images/welcome.gif, but
we got permission denied error:

*******************************************************************************
[Mon Jan 14 10:50:01 2008] [notice] Apache/2.0.52 (Red Hat) configured --
resuming normal operations
[Mon Jan 14 10:50:39 2008] [error] [client 171.64.19.235] (13)Permission denied:
access to /selfservice/images/welcome.gif denied
*******************************************************************************  

Note there is no welcome.gif file in
/usr/share/tomcat5/webapps/selfservice/image (we removed it), but there is one
in /var/www/html/selfservice/images.  The file permission on
/var/www/html/selfservice/images is OK because if we use mod_rewrite the files
are served correctly.

We added "JkMountCopy On" in virtual host directive as you suggested, but it
made no difference.

Here is the current conf file:

*************************************************
DocumentRoot /var/www/html

# load mod_jk
#LoadModule jk_module modules/mod_jk.so
JkWorkersFile "/etc/httpd/workers.properties"
JkLogFile "/var/log/httpd/mod_jk.log"
JkLogLevel debug
JkAutoAlias /usr/share/tomcat5/webapps
JkMount /selfservice/* worker1
JkUnMount /selfservice/*.html worker1
JkUnMount /selfservice/*.jpg  worker1
JkUnMount /selfservice/*.gif  worker1

<VirtualHost *:80>
    ServerName  www.examples.com
    ServerAlias examples
    JkMountCopy On
    DocumentRoot /var/www/html
</VirtualHost>
************************************************


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 44215] - jkunmount causes apache to throw permission denied error

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44215>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=44215





------- Additional Comments From rainer.jung@kippdata.de  2008-01-12 03:52 -------
Sorry, typo in previous comment: Out -> Put

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org