Works perfectly. Thank you.<br><br><br>Sergej<br><br><br><div class="gmail_quote">2009/3/16 Igor Sysoev <span dir="ltr">&lt;<a href="mailto:is@rambler-co.ru">is@rambler-co.ru</a>&gt;</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>
&gt; I&#39;m trying to use the new feature from 0.7.40 - captures in server_name.<br>
&gt; I use $document_root in SCRIPT_FILENAME for fastcgi. The problem is that the<br>
&gt; captured part of server_name is not being used. If I check my access log, it<br>
&gt; will say this:<br>
&gt; 404 .... /var/www/htdocs//index.php<br>
&gt;<br>
&gt; For a regular index.php, the path will be correct and the captured part will<br>
&gt; be in it:<br>
&gt; 200 .... /var/www/htdocs/domain/index.html<br>
&gt;<br>
&gt; This is the gist of my config:<br>
&gt;<br>
&gt; server {<br>
&gt;   listen 80;<br>
&gt;   server_name   ~^(www\.)?(.+)\.(.+)$;<br>
&gt;   root /var/www/htdocs/$2;<br>
&gt;<br>
&gt;   log_format  main  &#39;$status &quot;$request&quot; $body_bytes_sent $remote_addr<br>
&gt; $document_root$fastcgi_script_name&#39;;<br>
&gt;   ....<br>
&gt;<br>
&gt;    location ~ .php$ {<br>
&gt;       fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;<br>
&gt;       ... # normal fastcgi params<br>
&gt;     }<br>
&gt;   }<br>
&gt; }<br>
&gt;<br>
&gt; Is this a bug or an incorrect config on my part?<br>
<br>
</div></div>The &quot;root /var/www/htdocs/$2&quot; is evaluated in &quot;location ~ .php$&quot; context,<br>
therefore, the &quot;.php$&quot; 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>