I have this config, I need to use jpg in /data/abc/files/ but when I
browse it nginx will use file jpg in /var/www/images (second condition),
how to fix it?
root /var/www/images;
location = /abc/files/ {
alias /data/abc/files/;
break;
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|swf|flv)$ {
access_log off;
expires 1d;
}
On Fri, Jun 11, 2010 at 4:38 PM, Life L. [email protected] wrote:
I have this config, I need to use jpg in /data/abc/files/ but when I
browse it nginx will use file jpg in /var/www/images (second condition),
how to fix it?
root /var/www/images;
location = /abc/files/ {
will only match address /abc/files/. Remove =.
    alias /data/abc/files/;
    break;
}
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|swf|flv)$ {
    access_log  off;
    expires   1d;
}
but any jpg will probably get in here anyway, so I guess using
location ~* ^/abc/files/(.)$ {
alias /data/abs/files/$1;
}
is better. Also make sure to put that block above the location ~
.(jpg|jpeg|gif|css|png|js|ico|swf|flv)$ { } block.
–
Posted via http://www.ruby-forum.com/.
nginx mailing list
[email protected]
nginx Info Page
–
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
On Fri, Jun 11, 2010 at 11:38:27AM +0200, Life L. wrote:
location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|swf|flv)$ {
access_log off;
expires 1d;
}
- “break” is useless here and only wastes CPU cycles.
- you may use “root” instead of “alias”
- “=” is exact match, but not prefix match.
- “^~” disables testing regexes, thus
location ^~ /abc/files/ {
root /data/;
}
–
Igor S.
http://sysoev.ru/en/