ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Организация локейшенов


  • To: "nginx-ru@xxxxxxxxx" <nginx-ru@xxxxxxxxx>
  • Subject: Re: Организация локейшенов
  • From: Denis F. Latypoff <latypoff@xxxxxxxxx>
  • Date: Mon, 28 May 2012 22:03:13 +0700
  • Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1338217394; bh=HpTwNLQ1b6+6D7P0con+WRvB0RAUu7EVWH4BRceaLks=; h=From:To:In-Reply-To:References:Subject:MIME-Version:Message-Id: Date:Content-Transfer-Encoding:Content-Type; b=uCzkSyrVe69JM0XlG0nVfrkilJ4VDZB1Xeg7gNdZy/ZoFeTyHuIrIsz7mSdUFBT5c 2IBjdIA+mbNwcyvsIuA2bqTMnnos+G/6DcAZJVNXKE+hkp1kVN5MT0qT+vRMEFl/Dn fwDX0Bqfsz0h4cFeNWeMZK7Mn59y2olpHTR4Vn/g=
  • Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1338217394; bh=HpTwNLQ1b6+6D7P0con+WRvB0RAUu7EVWH4BRceaLks=; h=From:To:In-Reply-To:References:Subject:MIME-Version:Message-Id: Date:Content-Transfer-Encoding:Content-Type; b=uCzkSyrVe69JM0XlG0nVfrkilJ4VDZB1Xeg7gNdZy/ZoFeTyHuIrIsz7mSdUFBT5c 2IBjdIA+mbNwcyvsIuA2bqTMnnos+G/6DcAZJVNXKE+hkp1kVN5MT0qT+vRMEFl/Dn fwDX0Bqfsz0h4cFeNWeMZK7Mn59y2olpHTR4Vn/g=
  • In-reply-to: <c175c84d5c012659e9032c8fb299f548.NginxMailingListRussian@forum.nginx.org>
  • References: <c175c84d5c012659e9032c8fb299f548.NginxMailingListRussian@forum.nginx.org>


28.05.2012, 21:58, "c350" <nginx-forum@xxxxxxxx>:
> Здравствуйте.
>
> Как более грамотно написать?
>
> Вариант 1):
> set $backend 'http://127.0.0.10:80';
> location ~* /location1 {
>         rewrite ^ /backend_scripts/path/to/script1 break;
>         proxy_pass $backend$uri$is_args$args;
> }
> ...
> location ~* /locationN {
>         rewrite ^ /backend_scripts/path/to/scriptN break;
>         proxy_pass $backend$uri$is_args$args;
> }
>
> Вариант 2):
> set $backend 'http://127.0.0.10:80';
> location ^~ /backend_scripts/ {
>         proxy_pass $backend$uri$is_args$args;
> }
> location ~* /location1 {
>         rewrite ^ /backend_scripts/path/to/script1 last;
> }
> ...
> location ~* /locationN {
>         rewrite ^ /backend_scripts/path/to/scriptN last;
> }
>
> Подозреваю, что более правильный
> вариант1, но хотелось бы услышать
> мнение знающих людей.
>

location ~* /location\d+ {
    rewrite /location(\d+) /backend_scripts/path/to/script$1 break;
    proxy_pass http://127.0.0.10;
}

-- 
br, Denis F. Latypoff.

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.