On Jan 12, 10:21 am, Graham Dumpleton <[email protected]>
wrote:
> On Jan 12, 6:48 am, mdipierro <[email protected]> wrote:
>
>
>
>
>
> > I have the following in my apache config
>
> > <VirtualHost *:80>
> >    ServerName mdp.cti.depaul.edu
> >    ServerAlias mdp.cti.depaul.edu
> >    ServerAliaswww.web2py.com
> >    ServerAdmin [email protected]
> >    Alias / /home/user/web2py/applications/
> >    <LocationMatch "/(.*)/static/(.*)$">
> >     Order deny,allow
> >     Allow from all
> >    </LocationMatch>
> >    <Location "/examples">
> >      Order deny,allow
> >      Allow from all
> >      ProxyPasshttp://127.0.0.1:8000/examples
> >      ProxyPassReversehttp://127.0.0.1:8000/
> >    </Location>
> > </virtualhost>
>
> > I want the former to take precedence over the latter so that static
> > files are served by apache not not by web2py. I cannot find a way to
> > do it. Any advice?
>
> You should read again my comments in:
>
>  http://blog.dscpl.com.au/search/label/web2py
>
> about the evils of using Location/LocationMatch for access control
> plus other stuff in my critique of your original mod_wsgi instructions
> as they are also somewhat relevant in regard to aliasing static
> directories. Also refer to the cleaned up mod_wsgi configuration in
> book 2nd edition.
>
> So, try using:
>
> <VirtualHost *:80>
>    ServerName mdp.cti.depaul.edu
>    ServerAlias mdp.cti.depaul.edu
>    ServerAliaswww.web2py.com
>    ServerAdmin [email protected]
>
>    AliasMatch ^/([^/]+)/static/(.*) /home/user/web2py/applications/$1/
> static/$2
>
>    <Directory /home/user/web2py/applications/*/static/>
>    Order Allow,Deny
>    Allow from all
>    </Directory>
>
>    ProxyPass /exampleshttp://127.0.0.1:8000/examples
>    ProxyPassMatch /examples/static !

Whoops, order is important. You also likely don't need a match as only
one suburl, thus:

   ProxyPass /examples/static !
   ProxyPass /examples http://127.0.0.1:8000/examples

Graham

>    ProxyPassReverse /exampleshttp://127.0.0.1:8000/examples
>
> </Virtualhost>
>
> In other words:
>
> 1. Move proxy outside of Location directive and explicitly supply
> mount point. No access control necessary as mod_proxy ignores it.
>
> 2. Add a proxy exclusion for the suburl for where static files are.
>
> 3. Add sub url as final argument to ProxyPassReverse.
>
> 4. Use properly qualified static file mounts.
>
> 5. Use Directory directive around giving access to the static
> directories. No abuse of Location/LocationMatch directives.
>
> Graham
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to