Combine location blocks with same content

location ^~ /categoria/personale-scolastico/area-docenti/ {
auth_basic “Restricted”;
auth_basic_user_file /var/www/domain/.pswd_docenti;
try_files $uri $uri/ /index.php?$args;
include
/etc/nginx/conf/.conf;
}
location ^~ /personale/ {
auth_basic “Restricted”;
auth_basic_user_file /var/www/domain/.pswd_docenti;
try_files $uri $uri/ /index.php?$args;
include
/etc/nginx/conf/
.conf;
}

location ^~ /colloqui/bs-events {
auth_basic “Restricted”;
auth_basic_user_file /var/www/domain/.pswd_docenti;
try_files $uri $uri/
/index.php?$args;
include
/etc/nginx/conf/*.conf;
}

Is there a way to combine these locations? The content of the blocks is
the same…
I tried with location ^~
(/categoria/personale-scolastico/area-docenti/|/personale/|/colloqui/bs-events)
but didn’t work…

location
http://nginx.org/en/docs/http/ngx_http_core_module.html#location
directive documentation states that ‘^~’ modifier matches prefix
locations,
not regular expression ones, thus trying to use ‘^~’ with a regular
expression will most probably always end up in a failure.

Try to use the regular expression case-(in)sensitive modifier.

B. R.

On Mon, Oct 6, 2014 at 3:28 PM, Lorenzo R.
[email protected]