tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: Please somebody can translate this configuration in tomcat form for server.xml or another xml config file?
Date Fri, 27 Jan 2012 14:02:34 GMT
Luciano Andress Martini wrote:
> I need to do this in tomcat6:
> Apache2 form:
> <Directory /var/www/temporarios/upload_contracheque>
>                 Order allow,deny
>                 deny from all
> </Directory>

I think that you are again not very clear, but I will try to guess.

There is no direct equivalent of the above in Tomcat, because Tomcat works on the base of

"context" rather than "disk directory".
(For an Apache2 equivalent, think <Location> instead of <Directory>).

So to re-phrase your question :
You have a directory in Tomcat, like (tomcat_dir)/webapps/mywebapp/X , and you want to 
prevent (all) web users from accessing the content of that sub-directory X. Yes ?

If yes, then the best way of achieving this is probably to have this directory be outside

of the Tomcat /webapps/ space (better even, totally outside the Tomcat directory tree).
If you need to access it from Apache2, then you can always use an Alias in Apache2.

/var/www/site1/docs/  = Apache2 DocumentRoot

/var/www/tomcat/webapps/ = Tomcat webapps dir

/var/www/temporarios/upload = directory where the files are uploaded

In Apache2 :

Alias /temporarios/ /var/www/temporarios/
<Directory /var/www/temporarios>
   .....  (Allow/deny and other things) ...

In Tomcat : nothing  (Tomcat will not even see this directory, and no Tomcat URL can reach


If your Tomcat webapp needs to read/write there, then you decide that inside your Tomcat 
webapp.(And you give the Apache and the Tomcat user the appropriate user-id & permissions

to read/write there).

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message