5

In the Nginx documentation, context for some directives (error_page directive for example) is given as follows:

Context: http, server, location, if in location

My question is, what does "if in location" context mean? I've been googling but couldn't find a proper explanation.

1 Answer 1

6

There are two distinct contexts for an if block, server and location.

The behaviour in these two contexts are quite different.

Example:

server {
    if (...) { ... }

    location ... {
        if (...) { ### }
    }
}

The first if block is in server context. The second if block is in location context.

The context if in location specifies directives that may appear within the ### section in the above example.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.