Не рабоает alias

Roxis roxis at list.ru
Sat Sep 20 19:39:50 MSD 2008


On Saturday 20 September 2008, Rauan Maemirov wrote:
> nginx версии 0.7.13
>
> location /userpics/ {
>         alias /var/user/userpics/;
> }
>
> права на папку 777 и один и тот же юзер.
>
> там картинка лежит (имя файла "нормальное". jpg). но выдает 404.
>
> Чуть ниже еще один location.
>
>
> location ~ "\.(js|ico|gif|jpg|mp3|png|txt|css|swf)$" {
>         expires 30d;
>         root /home/project/html;
> }
>
> debug log
>
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http uri: "/userpics/quessir.jpg"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http args: ""
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http exten: "jpg"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http process request header line
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http header: "Host: mysite.kz"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http header: "User-Agent:
> Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9.0.1)
> Gecko/2008070208 Firefox/3.0.1"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http header: "Accept:
> text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http header: "Accept-Language:
> en-us,en;q=0.5"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http header: "Accept-Encoding:
> gzip,deflate"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http header: "Accept-Charset:
> ISO-8859-1,utf-8;q=0.7,*;q=0.7"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http header: "Keep-Alive: 300"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http header: "Connection:
> keep-alive"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http header: "Cookie:
> PHPSESSID=vtqape9137kn0bjs630o1vqhq6"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 http header done
> 2008/09/06 21:02:53 [debug] 32336#0: *1 event timer del: 16: 942721589
> 2008/09/06 21:02:53 [debug] 32336#0: *1 generic phase: 0
> 2008/09/06 21:02:53 [debug] 32336#0: *1 test location: "/"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 test location: "services/upload/"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 test location: "userpics/"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 test location: ~ "\.php$"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 test location: ~
> "\.(js|ico|gif|jpg|mp3|png|txt|css|swf)$"
> 2008/09/06 21:02:53 [debug] 32336#0: *1 using configuration
> "\.(js|ico|gif|jpg|mp3|png|txt|css|swf)$"
>
>
> Как видите перескакивает.

это ожидаемое поведение, читайте 
http://sysoev.ru/nginx/docs/http/ngx_http_core_module.html#location

вам нужно:

location ^~ /userpics/ {
 alias /var/user/userpics/;
}

или лучше:

location ^~ /userpics/ {
  root /var/user;
}





More information about the nginx-ru mailing list