Welcome! Log In Create A New Profile

Advanced

Re: Реврайт по имени сервера

March 19, 2010 04:15AM
Извернулся так. Теперь для каждого запроса в переменную падает хост разбитый по 2м символам.

[code]
perl_modules perl/lib;

perl_set $splitted_host '
sub {
my $r = shift;
my $host = $r->header_in("Host");
my $charsSectionLength = 2;

($host) = ($host =~ m/^(?:www\.)?([^:]+)(?:\:\d+)?$/);
$host =~ s/(\.)/_/;

my $bits = join "/", ( $host =~ /.{1,$charsSectionLength}/gs );

return $bits;
}

';

......

server {
listen 80;
server_name _;
server_name_in_redirect off;

.......

location ~* ^.+.(jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$ {
root /long/path/to/static/content/root/$splitted_host/;
}
[/code]
Subject Author Posted

Реврайт по имени сервера

Johnatan Nevermind March 17, 2010 03:19AM

Re: Реврайт по имени сервера

Sergey Shepelev March 17, 2010 03:28AM

Re: Реврайт по имени сервера

Johnatan Nevermind March 17, 2010 07:00AM

Re: Реврайт по имени сервера

Sergey Averyanov March 17, 2010 07:08AM

Re: Реврайт по имени сервера

Sergey Shepelev March 17, 2010 07:18AM

Re: Реврайт по имени сервера

Johnatan Nevermind March 19, 2010 04:15AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 156
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready