Re: виртуальные сервера
    Alexander Dolgarev 
    a.dolgarev at gmail.com
       
    Sat Dec 29 02:47:02 MSK 2007
    
    
  
Спасибо, сработало
        location / {
            #root   html;
            index  index.html index.htm index.php;
            #rewrite location to zone/domain/subdomain/file
            set $vroot html;
            if ($http_host ~ ^([^.]+)\.([^.]+)\.([^.]+)$) {
                set $vroot html/$3/$2/$1;
            }
            if ($http_host ~ ^([^.]+)\.([^.]+)$) {
                set $vroot html/$2/$1;
            }
            if ($http_host ~ ^([^.]+)$) {
                set $vroot html/$1;
            }
            root   $vroot;
        }
надо потестить, насколько это быстро работает
On Dec 29, 2007 1:14 AM, Roxis <roxis at list.ru> wrote:
> On Saturday 29 December 2007, Alexander Dolgarev wrote:
> > Нельзя ли это сделать спомощью модуля ngx_http_rewrite? Что-то вроде
> > rewrite  ^(.*)/([^/]*)$  $1/$zone/$domain/$subdomain/$2  last;
> >
> > только как получить $zone, $domain и $subdomain из заголовка Host?
>
> типа такого:
>
> set $mypath /www/default;
>
> if ($http_host ~ ^([a-z\d]+)\.([a-z\d]+)\.([a-z\d]+)$) {
>     set $mypath /www/$3/$2/$1;
> }
>
> root $mypath;
>
    
    
More information about the nginx-ru
mailing list