How to set a option within a location block

Igor Sysoev igor at sysoev.ru
Wed Jul 7 15:26:17 MSD 2010


On Wed, Jul 07, 2010 at 12:22:02PM +0100, --[ UxBoD ]-- wrote:

> ----- Original Message -----
> > On Wed, Jul 07, 2010 at 11:12:42AM +0100, --[ UxBoD ]-- wrote:
> > 
> > > ----- Original Message -----
> > > > On Wed, Jul 07, 2010 at 10:06:16AM +0100, --[ UxBoD ]-- wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I have the URL http://www.xyz.com/dav/xxx and I need to be able
> > > > > to
> > > > > set http_timeout only when /dav/ is present in the URL. The
> > > > > problem
> > > > > is that the configuration is third party supplied and they
> > > > > already
> > > > > have:
> > > > >
> > > > > location /
> > > > > {
> > > > >
> > > > > }
> > > > >
> > > > > So is it possible to have a location within a location for
> > > > > something
> > > > > like:
> > > > >
> > > > > location /
> > > > > {
> > > > >     location ^~ /dav/ {
> > > > >         keepalive_timeout 0;
> > > > >     }
> > > > > }
> > > >
> > > > It's possible, but why can not you add
> > > >
> > > > location /dav/ {
> > > > }
> > > >
> > > > before or after
> > > >
> > > > location / {
> > > > }
> > > >
> > > > ?
> > >
> > > Would need to duplicate all the other options within the /dav/ block
> > > as once it matches it does not process the other location block.
> > 
> > You may move common directives outside "location /":
> > 
> > common all directives
> > 
> > location / {
> > }
> > 
> > location /dav/ {
> > }
> > 
> 
> Igor, to be clear on the flow then that would process all the directives under '/' and then if the URI contains /dav/ it would also pull in what ever is in that location block; in essence inherit all the directives ?

No, please read this:
http://nginx.org/en/docs/http/request_processing.html#simple_php_site_configuration


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list