Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Автоматические субдоме ны, логгирование каждого субдомена
On Fri, Sep 03, 2010 at 08:48:57PM +0300, Vladislav V. Prodan wrote:
> 03.09.2010 19:07, Vladislav V. Prodan пишет:
>
> > /var/www/domain.com/
> > /var/www/domain.com/sub/$subdomain
> > /var/www/domain.net/
> > /var/www/domain.net/sub/$subdomain
> >
>
> Сделал пока так.
>
> server {
> listen xxx.xxx.xxx.85:80;
> server_name domain.com *.domain.com;
> ...
> root /www/domain.com/$subdomain;
> set $subdomain "";
> if ($host ~* ^([a-z0-9-\.]+)\.domain.com$) {
> set $subdomain "sub/$1";
> }
> if ($host ~* ^www.domain.com$) {
> set $subdomain "";
> }
> ...
> }
>
> server {
> listen xxx.xxx.xxx.85:80;
> server_name domain.net *.domain.net;
> ...
> root /www/domain.net/$subdomain;
> set $subdomain "";
> if ($host ~* ^([a-z0-9-\.]+)\.domain.net$) {
> set $subdomain "sub/$1";
> }
> if ($host ~* ^www.domain.net$) {
> set $subdomain "";
> }
> ...
> }
server {
server_name ~^(?<MAIN>domain\.(?:net|com))$
root /www/$MAIN;
}
server {
server_name ~^(?<SUB>[\w\-\.]+)\.(?<MAIN>domain\.(?:net|com))$
root /www/$MAIN/sub/$SUB;
}
--
Игорь Сысоев
http://sysoev.ru
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru
|