Combine location blocks with same content

B.R. reallfqq-nginx at yahoo.fr
Mon Oct 6 15:24:47 UTC 2014


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 Raffio <multiformeingegno at gmail.com>
wrote:

>  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..
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20141006/33c20819/attachment.html>


More information about the nginx mailing list