Welcome! Log In Create A New Profile

Advanced

Re: location

June 30, 2010 11:50AM
On Wed, Jun 30, 2010 at 10:02:46AM -0400, VadimK wrote:

> Есть конфиг, в нем указанно следующее
> [code]
> server {
> listen 80;
> server_name ~^(.*)\.(.*\..*)\.x$;
> set $x_document_root w:/www/$1.$2/;
>
> error_log logs/error.log debug;
> access_log logs/access.log main;
> index index.php index.html;
>
> location ~ ^/asm/(.*\.php)$ {
> fastcgi_pass 127.0.0.1:521;
> fastcgi_param SCRIPT_FILENAME
> w:/www/core/$fastcgi_script_name;
> include fastcgi_params;
> fastcgi_param DOCUMENT_ROOT $x_document_root;
> }
>
> location ~ ^/asm/ {
> alias w:/www/core/asm/;
> }
>
> location ~ \.php$ {
> fastcgi_pass 127.0.0.1:521;
> fastcgi_index index.php;
> fastcgi_param SCRIPT_FILENAME
> $x_document_root$fastcgi_script_name;
> include fastcgi_params;
> }
> }
> [/code]
>
> Т.е. по правилам, если я запрашиваю
> /asm/js/jquery/jquery.tablednd.js , то должна
> выполниться часть
> [code]
> location ~ ^/asm/ {
> alias w:/www/core/asm/;
> }
> [/code]
> Оно в общем так и происходит, но всегда
> теряется первый символ в адресе
> запрашиваемой страницы.

Потому что nginx заменяет первые 6 символов (длина "^/asm/") в запросе
на "w:/www/core/asm/". Правильно так:

location ~ ^/asm/ {
root w:/www/core;
}

Кроме того,
set $x_document_root w:/www/$1.$2/;
не нужно:

server_name ~^(?<F>.*)\.(?<S>.*\..*)\.x$;
root w:/www/$F.$S/;

location ~ ^/asm/(.*\.php)$ {
...
fastcgi_param DOCUMENT_ROOT $document_root;
}


--
Игорь Сысоев
http://sysoev.ru

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

location

VadimK June 30, 2010 10:02AM

Re: location

Igor Sysoev June 30, 2010 11:50AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 127
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready