help with location and order
Igor Sysoev
igor at sysoev.ru
Fri Jun 11 14:04:31 MSD 2010
On Fri, Jun 11, 2010 at 11:38:27AM +0200, Life Life 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/ {
> alias /data/abc/files/;
> break;
> }
>
> location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|swf|flv)$ {
> access_log off;
> expires 1d;
> }
1) "break" is useless here and only wastes CPU cycles.
2) you may use "root" instead of "alias"
3) "=" is exact match, but not prefix match.
4) "^~" disables testing regexes, thus
location ^~ /abc/files/ {
root /data/;
}
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list