<div dir="ltr"><div>Спасибо, Игорь, но это не помогло ;-(</div>
<div>&nbsp;</div>
<div>Директория содержит поддиректории, никаких текстовых файлов.</div>
<div>Да и это не важно..любая директория с/без пхп файлами внутри идет на бэкенд через 301&nbsp;при отсутствии&nbsp;слэша в конце URL</div>
<div>&nbsp;</div>
<div>proxy_pass срабатывает при / только.</div>
<div>&nbsp;</div>
<div>Тут что-то с этим trailing slash в конце...я ожидал, что nginx&nbsp;сам добавит слеш, а в итоге&nbsp; - бэкенд в адрес баре&nbsp;и 301...</div>
<div>&nbsp;</div>
<div>Спасибо</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>&nbsp;</div>
<div>
<hr>
</div><pre>On Tue, Dec 09, 2008 at 05:13:39PM +0200, Alex Umansky wrote:

&gt; В конфиге прописано только прокси для пхп
&gt; 
&gt; #MAIN LOCATION
&gt;        location / {
&gt;        root /var/www/html/;
&gt;         if (-f $request_filename.php) {
&gt;         proxy_pass <a href="http://dynamic.domain.com/" rel="nofollow">http://dynamic.domain.com</a>;
&gt;         break;
&gt;         }
&gt;        }
&gt; 
&gt; 
&gt; Кусок лога действительно не тот
&gt; 
&gt; вот полный ( с запросом на /data)
&gt; 
&gt; повторюсь, что все работает. Проблема только при реквесте директории без
&gt; слеша.
&gt; По идее (так апаче делал), он должен понять файл это или директория. Может
&gt; модуль какой пропустил?

Ну вот, видимо, Апач на бэкенде и определяет, что это каталог и
возращает его со слэшом:
      Location: <a href="http://dynamic.domain.com/data/" rel="nofollow">http://dynamic.domain.com/data/</a>

Если нужно, что после nginx&#39;а выходил Location: <a href="http://www.domain.com/data/" rel="nofollow">http://www.domain.com/data/</a>,
то нужно поставить

       root  ...
+      proxy_redirect  <a href="http://dynamic.domain.com/" rel="nofollow">http://dynamic.domain.com/</a>  /;
       if ...

Непонятно только, почему происходит проксирование.
Файл /var/www/html/data.php существует ?

&gt; ./nginx -V
&gt; nginx version: nginx/0.6.34
&gt; built by gcc 3.4.6 20060404 (Red Hat 3.4.6-9)
&gt; configure arguments: --prefix=/usr/local/nginx --user=apache --group=apache
&gt; --with-http_ssl_module --with-http_realip_module
&gt; --with-http_gzip_static_module --without-http_fastcgi_module
&gt; --without-http_empty_gif_module --http-log-path=/var/log/nginx
&gt; --with-http_stub_status_module --with-debug
&gt; 
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 event timer del: 473: 474497423
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 generic phase: 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 generic phase: 1
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location for &quot;/data&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: &quot;/&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: &quot;/&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: &quot;/&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: &quot;/nginx_status&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: ~
&gt; &quot;/([0-9]+)/([0-1][0-9])/&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: ~
&gt; &quot;/([0-9]+)/([2-3][0-9])/&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: ~
&gt; &quot;/([0-9]+)/([4-5][0-9])/&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: ~
&gt; &quot;/([0-9]+)/([6-7][0-9])/&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: ~
&gt; &quot;/([0-9]+)/([8-9][0-9])/&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: ~
&gt; &quot;^.+\.(jpg|jpeg|gif)$&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: ~
&gt; &quot;^.+\.(html|js|css)$&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 find location: ~ &quot;\.xml$&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 using configuration &quot;/&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http cl:-1 max:0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 generic phase: 3
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 post rewrite phase: 4
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 generic phase: 5
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 generic phase: 6
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 access phase: 7
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 access phase: 8
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 post access phase: 9
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http init upstream, client
&gt; timer: 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 epoll add event: fd:473 op:3
&gt; ev:80000005
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script copy: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script var: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script copy: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script copy: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script var: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script copy: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script copy: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script var: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script copy: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script copy: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script var: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script copy: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http script copy: &quot;&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header: &quot;Accept:
&gt; image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
&gt; application/x-shockwave-flash, application/vnd.ms-excel,
&gt; application/vnd.ms-powerpoint, application/msword, application/xaml+xml,
&gt; application/vnd.ms-xpsdocument, application/x-ms-xbap,
&gt; application/x-ms-application, application/x-silverlight, */*&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header:
&gt; &quot;Accept-Language: en-us,he;q=0.5&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header:
&gt; &quot;Accept-Encoding: gzip, deflate&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header: &quot;User-Agent:
&gt; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB5; .NET CLR
&gt; 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR 3.0.04506.648;
&gt; FDM)&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header: &quot;Cookie:
&gt; xxx&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header:
&gt; &quot;GET /data HTTP/1.0
&gt; X-Forwarded-For:  xxx.xxx.xxx.xxx
&gt; X-Forwarded-Host: <a href="http://www.domain.com">www.domain.com</a>
&gt; Host: <a href="http://dynamic.domain.com">dynamic.domain.com</a>
&gt; X-Forwarded-Server: <a href="http://www.domain.com">www.domain.com</a>
&gt; Connection: close
&gt; Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
&gt; application/x-shockwave-flash, application/vnd.ms-excel,
&gt; application/vnd.ms-powerpoint, application/msword, application/xaml+xml,
&gt; application/vnd.ms-xpsdocument, application/x-ms-xbap,
&gt; application/x-ms-application, application/x-silverlight, */*
&gt; Accept-Language: en-us,he;q=0.5
&gt; Accept-Encoding: gzip, deflate
&gt; User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; GTB5;
&gt; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30; .NET CLR
&gt; 3.0.04506.648; FDM)
&gt; Cookie: xxx&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http cleanup add: 09B373F8
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 get rr peer, try: 1
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 socket 543
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 epoll add connection: fd:543
&gt; ev:80000005
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 connect to <a href="http://10.232.22.170:80">10.232.22.170:80</a>,
&gt; fd:543 #914137
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http upstream connect: -2
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 event timer add: 543:
&gt; 90000:474407435
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 post event B79CD6B8
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 delete posted event B79CD6B8
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http upstream check client,
&gt; write event:1, &quot;/data&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http upstream recv(): -1 (11:
&gt; Resource temporarily unavailable)
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 post event B79CE454
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 delete posted event B79CE454
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http upstream send request
&gt; handler
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http upstream send request
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 chain writer buf fl:1 s:1038
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 chain writer in: 09B37414
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 writev: 1038
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 chain writer out: 00000000
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 event timer del: 543: 474407435
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 event timer add: 543:
&gt; 90000:474407438
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 post event B7B6B454
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 post event B79CE454
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 delete posted event B79CE454
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http upstream dummy handler
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 delete posted event B7B6B454
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http upstream process header
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 malloc: 09C2FB20:4096
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 recv: fd:543 516 of 4096
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy status 301 &quot;301
&gt; Moved Permanently&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header: &quot;Date: Tue,
&gt; 09 Dec 2008 15:02:08 GMT&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header: &quot;Server:
&gt; Apache&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header: &quot;Location:
&gt; <a href="http://dynamic.domain.com/data/&quot;" rel="nofollow">http://dynamic.domain.com/data/&quot;</a>;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header:
&gt; &quot;Content-Length: 303&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header: &quot;Connection:
&gt; close&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header:
&gt; &quot;Content-Type: text/html; charset=iso-8859-1&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http proxy header done
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 HTTP/1.1 301 Moved Permanently
&gt; Server: nginx/0.6.34
&gt; Date: Tue, 09 Dec 2008 15:02:44 GMT
&gt; Content-Type: text/html; charset=iso-8859-1
&gt; Connection: keep-alive
&gt; Keep-Alive: timeout=30
&gt; Location: <a href="http://dynamic.domain.com/data/" rel="nofollow">http://dynamic.domain.com/data/</a>
&gt; Content-Length: 303
&gt; 
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 write new buf t:1 f:0 09B3760C,
&gt; pos 09B3760C, size: 248 file: 0, size: 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http write filter: l:0 f:0
&gt; s:248
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http upstream process upstream
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 pipe read upstream: 1
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 pipe preread: 303
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 readv: 1:3580
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 pipe recv chain: 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 pipe buf free s:0 t:1 f:0
&gt; 09C2FB20, pos 09C2FBF5, size: 303 file: 0, size: 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 input buf #0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 pipe write downstream: 1
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 pipe write downstream flush in
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http output filter &quot;/data?&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 copy filter: &quot;/data?&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 malloc: 09CE9158:4096
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http postpone filter &quot;/data?&quot;
&gt; 09B377F4
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http postpone filter out
&gt; &quot;/data?&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 write old buf t:1 f:0 09B3760C,
&gt; pos 09B3760C, size: 248 file: 0, size: 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 write new buf t:1 f:0 09C2FB20,
&gt; pos 09C2FBF5, size: 303 file: 0, size: 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http write filter: l:0 f:0
&gt; s:551
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 copy filter: 0 &quot;/data?&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 pipe write downstream done
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 event timer: 543, old:
&gt; 474407438, new: 474407439
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http upstream exit: 00000000
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 finalize http upstream request:
&gt; 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 finalize http proxy request
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 free rr peer 1 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 close http upstream connection:
&gt; 543
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 event timer del: 543: 474407438
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http upstream temp fd: -1
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http output filter &quot;/data?&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 copy filter: &quot;/data?&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http postpone filter &quot;/data?&quot;
&gt; BFEED108
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http postpone filter out
&gt; &quot;/data?&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 write old buf t:1 f:0 09B3760C,
&gt; pos 09B3760C, size: 248 file: 0, size: 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 write old buf t:1 f:0 09C2FB20,
&gt; pos 09C2FBF5, size: 303 file: 0, size: 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 write new buf t:0 f:0 00000000,
&gt; pos 00000000, size: 0 file: 0, size: 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http write filter: l:1 f:0
&gt; s:551
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http write filter limit 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 writev: 551
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http write filter 00000000
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 copy filter: 0 &quot;/data?&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http finalize request: 0,
&gt; &quot;/data?&quot;
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 set http keepalive handler
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http close request
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http log handler
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 free: 09C2FB20
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 free: 09B36800, unused: 4
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 free: 09CE9158, unused: 3683
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 event timer add: 473:
&gt; 30000:474347439
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 free: 09AC0710
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 free: 099B8E50
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 hc free: 00000000 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 hc busy: 00000000 0
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 tcp_nodelay
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 post event B7B6A6B8
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 delete posted event B7B6A6B8
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 http keepalive handler
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 malloc: 099B8E50:1024
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 recv: fd:473 -1 of 1024
&gt; 2008/12/09 10:02:44 [debug] 22188#0: *914133 recv() not ready (11: Resource
&gt; temporarily unavailable)
&gt; 
&gt; 
&gt; 
&gt; 
&gt;  Спасибо!

-- 
Игорь Сысоев
<a href="http://sysoev.ru/" rel="nofollow">http://sysoev.ru</a>
</pre></div>