Now i’ll write two sections of location as follow:
location =/aaa{}
location =/BBB{}
But I want to write the two sections to one location? eg. location
=/[aaa,BBB]{} , but it’s wrong, and does someone know how to write it?
Thanks in advance.
Now i’ll write two sections of location as follow: location =/aaa{}
location =/BBB{} But I want to write the two sections to one
location? eg. location =/[aaa,BBB]{} , but it’s wrong, and does
someone know how to write it? Thanks in advance.
Yes but without exact matching like you have. AFAIK you need a
regex.
Now i’ll write two sections of location as follow:
location =/aaa{}
location =/BBB{}
But I want to write the two sections to one location? eg. location
=/[aaa,BBB]{} , but it’s wrong, and does someone know how to write it?
Thanks in advance.
if you want it to contain same thing, just create another file and
include that file:
location = /aaa {
include blah;
}
location = /bbb {
include blah;
}
alternatively someone may have made a tool to batch such job.
Or the slow (and therefore not recommended) way:
location ~ ^/(aaa|bbb)$ {
…
}
I had the idea to create a glob-like syntax which expands the
expression automatically upon loading config but as I don’t have
enough C skill and apparently there’s already tool for that (and
deemed sufficient), it’s never got implemented.
On Fri, Jan 07, 2011 at 09:19:08PM +0700, Edho P Arief wrote:
include that file:
Or the slow (and therefore not recommended) way:
location ~ ^/(aaa|bbb)$ {
…
}
Note that regexp location is NOT the same thing. Location given
by regular expressions are quite different from “selecting
matching location” perspective.
E.g. for request “/aaa” this configuration will select “location =
/aaa”: