if (-f $request_filename) VS location ~* ^.+(css|gif|htm)

Igor Sysoev igor at sysoev.ru
Wed Jul 7 18:49:50 MSD 2010


On Wed, Jul 07, 2010 at 04:40:16PM +0200, Fernando Perez wrote:

> Hi,
> 
> Which is best between:
> 
> location / {
>   root /var/www/mysite;
> 
>   if (-f $request_filename) {
>     break;
>   }
> }
> 
> AND
> 
> location ~* ^.+(css|gif|html|jpeg|jpg|js|ogv|png|swf) {
>   root /var/www/mysite;
> }

This is different things.

BTW, this if:

   if (-f $request_filename) {
     break;
   }

is useless in

 location / {
   root /var/www/mysite;
 
   if (-f $request_filename) {
     break;
   }
}


-- 
Igor Sysoev
http://sysoev.ru/en/



More information about the nginx mailing list