Works perfectly. Thank you.<br><br><br>Sergej<br><br><br><div class="gmail_quote">2009/3/16 Igor Sysoev <span dir="ltr"><<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div></div><div class="h5">On Mon, Mar 16, 2009 at 02:35:06PM +0100, Rapsey wrote:<br>
<br>
> I'm trying to use the new feature from 0.7.40 - captures in server_name.<br>
> I use $document_root in SCRIPT_FILENAME for fastcgi. The problem is that the<br>
> captured part of server_name is not being used. If I check my access log, it<br>
> will say this:<br>
> 404 .... /var/www/htdocs//index.php<br>
><br>
> For a regular index.php, the path will be correct and the captured part will<br>
> be in it:<br>
> 200 .... /var/www/htdocs/domain/index.html<br>
><br>
> This is the gist of my config:<br>
><br>
> server {<br>
> listen 80;<br>
> server_name ~^(www\.)?(.+)\.(.+)$;<br>
> root /var/www/htdocs/$2;<br>
><br>
> log_format main '$status "$request" $body_bytes_sent $remote_addr<br>
> $document_root$fastcgi_script_name';<br>
> ....<br>
><br>
> location ~ .php$ {<br>
> fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;<br>
> ... # normal fastcgi params<br>
> }<br>
> }<br>
> }<br>
><br>
> Is this a bug or an incorrect config on my part?<br>
<br>
</div></div>The "root /var/www/htdocs/$2" is evaluated in "location ~ .php$" context,<br>
therefore, the ".php$" regex clears $2. The woraround is:<br>
<br>
server {<br>
<br>
server_name ~^(www\.)?(.+)\.(.+)$;<br>
set $domain $2;<br>
root /var/www/htdocs/$domain;<br>
<br>
BTW, you better to use 0.7.42, as there are bugfixes in captures.<br>
<font color="#888888"><br>
<br>
--<br>
Igor Sysoev<br>
<a href="http://sysoev.ru/en/" target="_blank">http://sysoev.ru/en/</a><br>
<br>
</font></blockquote></div><br>