How to set a option within a location block

Hi,

I have the URL .xyz Domain Names | Join Generation XYZ 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;
}
}

Thanks, Phil

Hello!

On Wed, Jul 7, 2010 at 1:06 PM, --[ UxBoD ]-- [email protected]
wrote:

So is it possible to have a location within a location for something like:

location /
{
location ^~ /dav/ {
keepalive_timeout 0;
}
}
Yes, it is possible.
You can even have such configuration:
location /
{
… all configuration …
location /dav
{
keepalive_timeout 0;
}
}


Boris D…

----- Original Message -----

    keepalive_timeout 0;
}
}

Thanks Boris, if the last command is a proxy_redirect and I add that
block after it will it be processed ?

Thanks, Phil

On Wed, Jul 7, 2010 at 1:19 PM, --[ UxBoD ]-- [email protected]
wrote:

Thanks Boris, if the last command is a proxy_redirect and I add that block after it will it be processed ?
If you mean, that you will have configuration,

location /
{
… some configuration …
proxy_redirect …;
location /svn
{
keepalive_timeout 0;
}
}

Than it is absolutely correct.


Boris D…

----- Original Message -----

{
}
}

?

Would need to duplicate all the other options within the /dav/ block as
once it matches it does not process the other location block.

Thanks, Phil

On Wed, Jul 07, 2010 at 10:06:16AM +0100, --[ UxBoD ]-- wrote:

location /
{
location ^~ /dav/ {
keepalive_timeout 0;
}
}

It’s possible, but why can not you add

location /dav/ {
}

before or after

location / {
}

?


Igor S.
http://sysoev.ru/en/

On Wed, Jul 07, 2010 at 11:12:42AM +0100, --[ UxBoD ]-- wrote:

location /
keepalive_timeout 0;
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 S.
http://sysoev.ru/en/

----- Original Message -----

location /svn
{
keepalive_timeout 0;
}
}

Than it is absolutely correct.

Odd as that completely broke the installation :frowning: Have had to move the
keepalive outside of the block for the time being. Will do more
testing.

Thanks, Phil

----- Original Message -----

problem
something

Would need to duplicate all the other options within the /dav/ block
}

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 ?

Thanks, Phil

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

set http_timeout only when /dav/ is present in the URL. The
So is it possible to have a location within a location for
It’s possible, but why can not you add

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 S.
http://sysoev.ru/en/

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

{
keepalive_timeout 0;
location / {
common all directives
also pull in what ever is in that location block; in essence inherit
all the directives ?

No, please read this:
How nginx processes a request

Ah okay :slight_smile: Thank you Igor that answers the question; will have to duplicate directives within the /dav/ like the / literal but also include the timeout. Is there any other way to include a specific directive without duplication ?

You may move them on upper level: server or http.
Or you may move them to a file and include the file.

However, I prefer to put all directives explicitly, this allows to
create
scaleable configurations.


Igor S.
http://sysoev.ru/en/

----- Original Message -----

wrote:

is that the configuration is third party supplied and
for
It’s possible, but why can not you add

location / {
all the directives ?

You may move them on upper level: server or http.
Or you may move them to a file and include the file.

However, I prefer to put all directives explicitly, this allows to
create
scaleable configurations.

Hi Igor, appreciate all the help you have provided. I think we shall
need to leave it within the server section; which is a pity as it will
apply to every URI eg:

where it would have been great for it to only apply to /dav; but the
literal location contains lots and lots of directives and I would hate
to duplicate them all into a separate location block.

Thanks, Phil

On Wed, Jul 7, 2010 at 7:18 PM, --[ UxBoD ]-- [email protected]
wrote:

where it would have been great for it to only apply to /dav; but the literal location contains lots and lots of directives and I would hate to duplicate them all into a separate location block.

use include ?


O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

----- Original Message -----

I have the URL .xyz Domain Names | Join Generation XYZ and I need to be

}

}

all the directives ?

No, please read this:
How nginx processes a request

Ah okay :slight_smile: Thank you Igor that answers the question; will have to
duplicate directives within the /dav/ like the / literal but also
include the timeout. Is there any other way to include a specific
directive without duplication ?

Thanks, Phil