Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ngx_http_rewrite_module и фа йлы с проб елами
- To: nginx-ru@xxxxxxxxx
- Subject: ngx_http_rewrite_module и фа йлы с проб елами
- From: Sergey Egorov <esvesv@xxxxxxxxx>
- Date: Thu, 4 Dec 2008 12:56:23 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:from:to :content-type:content-transfer-encoding:mime-version:subject:date :x-mailer; bh=JiRI/7AzHFD2FsuFIQkrRh1Fo94weiJgBEcuh95rKwM=; b=m2WQ6SW7AxBdFHYl7djCyaWos04/ISRFkgfaRA/FJAoEzyeJBlPljy5vgq3vqt1XNs wtxJhoiUKOBe5Sg0LkhnbqPKyQfBPJiHyG111+RUO7MeW95klLLytQHqyd9DZMy2Mik5 LupO/jWMYpqWnggZQs/BXAbk1UzO20Yim8JNA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:from:to:content-type:content-transfer-encoding :mime-version:subject:date:x-mailer; b=hXSKHAD3Vk7td706YC6ZfXCoYQWGTUwx/z4D6vqEHEt2zQn3fIslguhT5Ic4YjIiZI 3159bs6BguhdUkBa0dscPsgpA5MffI7YWzKJhQlYsBHfUGo4v37Pl9skAM5A66N9Tbi4 Imd0PA8FOBnP0HnGNcK6wOoK6nsQiNI9p7euI=
Hi!
Имеем вот такой запрос:
http://somesite.com/catalogue/images/PGF800%202.jpg
Задача: переписать URI, если файл есть на
диске в другом каталоге (к примеру /site/
clients/c81e728d9d4c2f636f067f89cc14862c)
Конфиг:
root /home/user/domains/site.com/public_html;
#если есть файл в обычном месте -
выходим сразу
if (-f $request_filename) {
break;
}
if ($request_filename ~ ^/home/user/domains/site.com/public_html(.*)
$) {
set $test /site/clients/c81e728d9d4c2f636f067f89cc14862c$1;
}
#тут поставил !-f чтобы была возможность
видеть лог, по идее тут -f
if (!-f $document_root$test) {
rewrite ^(.*)$ $test break;
}
Лог:
2008/12/04 00:08:04 [notice] 14088#0: *47 "^/home/user/domains/
site.com/public_html(.*)$" matches "/home/user/domains/site.com/
public_html/catalogue/images/PGF800 2.jpg", client: 88.85.170.161,
server: www.site.com, request: "GET /catalogue/images/PGF800%202.jpg
HTTP/1.1", host: "site.com"
2008/12/04 00:08:04 [notice] 14088#0: *47 "^(.*)$" matches "/catalogue/
images/PGF800 2.jpg", client: 88.85.170.161, server: www.site.com,
request: "GET /catalogue/images/PGF800%202.jpg HTTP/1.1", host:
"site.com"
2008/12/04 00:08:04 [notice] 14088#0: *47 rewritten data: "/site/
clients/c81e728d9d4c2f636f067f89cc14862c/catalogue/images/
PGF800%202.jpg", args: "", client: 88.85.170.161, server:
www.site.com, request: "GET /catalogue/images/PGF800%202.jpg HTTP/
1.1", host: "site.com"
2008/12/04 00:08:04 [error] 14088#0: *47 open() "/home/user/domains/
site.com/public_html/site/clients/c81e728d9d4c2f636f067f89cc14862c/
catalogue/images/PGF800%202.jpg" failed (2: No such file or
directory), client: 88.85.170.161, server: www.site.com, request:
"GET /catalogue/images/PGF800%202.jpg HTTP/1.1", host: "site.com"
Пробовал все последние версии nginx 0.5.37,
0.6.33, 0.7.24 - результат тот же.
Что делать? :(
Best regards
Sergey Egorov
|